Giter Site home page Giter Site logo

Comments (3)

billerickson avatar billerickson commented on August 14, 2024

I don't see how making the query a globally accessible variable would affect the query results. Do you have any code that is modifying display posts or the $dps_listing variable that might be conflicting with it?

Do you happen to have a staging site available? I'd love to hop in and debug the issue on your site without affecting your live website.

from display-posts-shortcode.

gzohop avatar gzohop commented on August 14, 2024

I don't see how making the query a globally accessible variable would affect the query results. Do you have any code that is modifying display posts or the $dps_listing variable that might be conflicting with it?

That's weird for me to.
I have not found any references to $dps_listing, I have tried even renaming it
but it does not change behavior.

Do you happen to have a staging site available? I'd love to hop in and debug the issue on your site without affecting your live website.

What kind of access would you need, shell access to the OS?(because it might be problematic :/)
Can you give me some ideas where to start debuging, I suspect that it has to be problem with custom theme that site uses?

from display-posts-shortcode.

billerickson avatar billerickson commented on August 14, 2024

I'd start by looking at the query arguments to see what is passed to WP_Query. I'd add something like this to your hteme's functions.php file (don't add this to the live site because the debugging code will be visible to everyone):

add_filter( 'display_posts_shortcode_args', function( $args, $atts ) {
	ea_pp( $args, 'Arguments' );
	ea_pp( $atts, 'Attributes );
	return $args;
}, 10, 2 );

/**
 * Pretty Printing
 *
 * @since 1.0.0
 * @author Chris Bratlien
 * @param mixed $obj
 * @param string $label
 * @return null
 */
function ea_pp( $obj, $label = '' ) {
	$data = json_encode( print_r( $obj,true ) );
	?>
	<style type="text/css">
		#bsdLogger {
		position: fixed;
		top: 0;
		right: 0px;
		border-left: 4px solid #bbb;
		padding: 6px;
		background: white;
		color: #444;
		z-index: 999;
		font-size: 1.25em;
		width: 400px;
		height: 100vh;
		overflow: scroll;
		}

		.admin-bar #bsdLogger {
			top: 32px;
			height: calc( 100vh - 32px );
		}
	</style>
	<script type="text/javascript">
		var doStuff = function(){
			var obj = <?php echo $data; ?>;
			var logger = document.getElementById('bsdLogger');
			if (!logger) {
				logger = document.createElement('div');
				logger.id = 'bsdLogger';
				document.body.appendChild(logger);
			}
			////console.log(obj);
			var pre = document.createElement('pre');
			var h2 = document.createElement('h2');
			pre.innerHTML = obj;
			h2.innerHTML = '<?php echo addslashes($label); ?>';
			logger.appendChild(h2);
			logger.appendChild(pre);
		};
		window.addEventListener ("DOMContentLoaded", doStuff, false);
	</script>
	<?php
}

I'd then comment out the global variable and run that code again to see if there's any change to the query arguments.

from display-posts-shortcode.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.