Search pre_get_posts filter which can handle multiple post types and categories?
You can set tax query in pre_get_posts hook as well: $query->set(‘tax_query’, array(__standart parameters__));
You can set tax query in pre_get_posts hook as well: $query->set(‘tax_query’, array(__standart parameters__));
If you hook some functions to the before_sidebar action, they will be executed in your code. Your action is now probably without any function hooked, so it returns nothing. Example: <?php add_action( ‘before_sidebar’, function() { echo ‘Try me!’; }); add_action( ‘before_sidebar’, function() { echo ‘Yep. ‘; }, 1); // this should output “Yep. Try me!” … Read more
publish_post doesn’t work for custom post types, the correct hook (action hook) is publish_{$custom_post_type}. You should use add_action() as this is an action hook. I also tend to make use of the transition_post_status hook which is a much more universal hook as it fires everytime a post’s status is changed regardless. You can use $old_status … Read more
wp_title() is for the html title tags in your websites head section. It’s not for outputting a title. Use the_title(), or get_the_title(),
When WordPress displays post content, it’s not running do_shortcode() on the post content, it’s running apply_filters( ‘the_content’, $content ). Shortcode filters are applied on the_content filter, which is why you have to add extra filters to get them to work in widgets or the footer or elsewhere.
You don’t have to declare the constructor public, just the action hook function. Example: <?php /* Plugin Name: Singleton Action */ class Singleton_Demo { /** * @static $instance Objekt * @access private; */ private static $_instance = NULL; protected function __construct() {} private final function __clone() {} public static function getInstance() { if ( self::$_instance … Read more
Even if a wp_list_categories filter exists, it passes (and so you have to return) the html markup generated by wp_list_categories() function. This means that if you want use that filter you have to alter the DOM with php, and even if it’s possible (hopefully using external php libraries), sure it’s not the best solution for … Read more
I am not sure I understand your issue right, but my guess is your conundrum – how to get to the title that is unchanged by your filter, if you are filtering it everywhere? You can use get_post_field() function to get a raw copy of it from the post object. However instead of messing with … Read more
This github repo has bdn.getPosts extended XML-RPC function to get category. Get 10 most recently modified posts in the sports category ($category can be either a slug or an ID) `array( 1, $username, $password, ‘post’, ‘sports’, 10, array( ‘orderby’ => ‘modified’ ) );`
Since version 4.9 visual composer added shortcode lazy loading. To use VC shortcodes on AJAX content use this function before printing the content WPBMap::addAllMappedShortcodes();. So below code may help you, function get_page_content(){ $id = $_REQUEST[‘id’]; $page_data = get_page($id); WPBMap::addAllMappedShortcodes(); echo apply_filters(‘the_content’, $page_data->post_content); wp_die(); } add_action( ‘wp_ajax_nopriv_get_page_content’, ‘get_page_content’ ); add_action( ‘wp_ajax_get_page_content’, ‘get_page_content’ );