Infinite blog loop
Your file is named content.php, and this line: get_template_part( ‘content’, get_post_format() ); will load the same file for posts with standard post format, causing your down-the-rabbit-hole loop.
Your file is named content.php, and this line: get_template_part( ‘content’, get_post_format() ); will load the same file for posts with standard post format, causing your down-the-rabbit-hole loop.
You’ll need a loop before you get to your sidebar loop to initiate your unique values. You could run the same loop twice, with rewind_posts() between the two loops ( so you get your original loop, starting from index 0 ). In your first loop, loop through and add all your values to an array … Read more
[Edit] If I understand correctly, what you call the “outer loop” is just for building a two-column layout. If so, you don’t need to call two WordPress loops, just open a “fake” oeuvres at the beginning, close a “fake” oeuvres at the end, do a single loop (a single while have_posts()) and close and re-open … Read more
Give this a try. It replaces query_posts(), which you should never use (it kills unicorns) with WP_Query. Basically it first queries your sticky posts and then, if there were less than your required 3 posts, it will perform another query for the relavent number of posts. /** Grab the sticky post ID’s */ $sticky = … Read more
I figured it out: $the_query = new WP_Query(array( “numberposts” => -1, “post_type” => “plays_events”, “meta_query” => array( array( “key” => “show_times_%_date”, “value” => $this_month . “[0-9]{2}”, “compare” => “REGEXP” ) ), ));
Try this: $args = array( ‘post_type’ => ‘post’, ‘posts_per_page’ => 3, ‘meta_key’ => ‘post_views_count’, ‘orderby’ => ‘meta_value_num’, ‘order’=> ‘ASC’, ‘date_query’ => array( array( ‘after’ => ’30 days ago’ ), ), ); $query = new WP_Query( $args ); You can’t directly order by met_key’s name, you need to use it the way it is above.
Please try the following javascript you need to add class to a tag for read more <a class=”readmode”>Read More</a> $(‘.readmode’).click(function() { $(this).siblings(‘.pop’).slideToggle(); return false; }); Here is the demo http://jsfiddle.net/fvcvyc1e/4/
If you have Yoast’s Analytics plugin, this wouldn’t be super hard. However, it will require some coding knowledge. I won’t spell everything out for you, but I will point you in the right direction. Without Yoast, you’ll have to review Lots of Documentation Load Yoast GA Files/Classes and Analytics ID from Yoast (or use Google … Read more
We can do that with the help of the get_media_embedded_in_content() function: /** * Display only the first media item in the content * * @link http://wordpress.stackexchange.com/a/199398/26350 */ ! is_admin() && add_filter( ‘the_content’, function( $content ) { // Get the avialable media items from the content add_filter( ‘media_embedded_in_content_allowed_types’, ‘wpse_media_types’ ); $media = get_media_embedded_in_content( $content ); remove_filter( … Read more
You could do this exchanging each page name for the page you want to use. I just tested and it seems to work. I’m sure there are downsides (speed for one). <?php /** * Template Name: OnePager */ <?php get_header(); ?> <!– Page One – How it Works –> <section id=”section1″> <div class=”container”> <div class=”col-sm-12″> … Read more