Add few specific post ids to wp_query

I have following args to get recent posts, $args = array( ‘date_query’ => array( array( ‘after’ => ‘1 week ago’ ) ), ‘posts_per_page’ => 15, ‘ignore_sticky_posts’ => 1, ‘meta_key’ => ‘post_views_count’, ‘orderby’ => ‘meta_value_num’, ‘order’ => ‘DESC’, ‘cat’ => ‘-907,-908,-909’ ); Now I need include few specific Ids to same query. So I tried follows, … Read more

Passing variables to template parts

I have one template file videos.php which has the following line of code in it (aswell as a load of HTML): <?php get_template_part(‘loop’, ‘feed-videos’ ); ?> inside that template part, I have the following: <?php $video = ‘video-‘ . $post->ID; ?> <?php get_template_part( ‘include’, ‘modal-video’ ); ?> I would then like to be able to … Read more

ob_get_clean returns empty string, ob_get_flush outputs string

I am utilizing a template-type system, to filter the_content. My filter contains this partial code: ob_start(); include_once ( self::$dir . ‘views/templates/’ . $post_type . “https://wordpress.stackexchange.com/” . $display . ‘.php’ ); $contents = ob_get_clean(); return $contents; For some reason, this works locally but not a test server (WP Engine – nginx). I have verified that the … Read more

bloginfo(‘stylesheet_directory’) vs. get_stylesheet_directory_uri() and include(‘file.php’) vs. get_template_part()

In my custom theme I’m using <img src=”https://wordpress.stackexchange.com/questions/75970/<?php bloginfo(“stylesheet_directory’); ?>/images/logo.jpg”/> to load my custom logo. I’m using a custom sidebar for front-page.php and that’s why I used <?php include(‘sidebar-front.php’) ?> to get it. But when I’m using the ‘theme-check’ plugin it’s suggesting to change the following: bloginfo(‘stylesheet_directory’) to get_stylesheet_directory_uri() include() to get_template_part() So, I did … Read more

Why does including a file in theme’s functions.php not work?

For example, if I write some code (e.d. add a custom post type or something) in my theme’s functions.php, it works fine. If I move it to a new file, then include() the file in my theme’s functions.php file, it no longer works (but debug code using error_log() still works. e.g. Here’s functions.php: <?php // … Read more

How to add a default include path for GCC in Linux?

I’d like gcc to include files from $HOME/include in addition to the usual include directories, but there doesn’t seem to be an analogue to $LD_LIBRARY_PATH. I know I can just add the include directory at command line when compiling (or in the makefile), but I’d really like a universal approach here, as in the library … Read more