Hook only specific post type
You need to set the number of arguments your filter accepts: add_filter( ‘the_title’, ‘alternatives_title’, 10 /* Priority */, 2 /* Arguments */ ); And you only need to use the_title (there is no get_the_title filter).
You need to set the number of arguments your filter accepts: add_filter( ‘the_title’, ‘alternatives_title’, 10 /* Priority */, 2 /* Arguments */ ); And you only need to use the_title (there is no get_the_title filter).
WordPress not updating post or disable plugin instead a white page appear
Given that the markup of your menu does not seems to generating all of the classes I’d expect to see, I’ll guess at the problem. Your theme is using a custom Walker Or something– theme or plugin– has added a filter to (probably) wp_nav_menu_css. Though there are other filters that could be used. To fix … Read more
SQL query to remove first image in all posts
You can simply include a custom search function into your search by using pre_get_posts You can do something like this function search_filter($query) { if ( !is_admin() && $query->is_main_query() ) { if ($query->is_search) { $query->set(‘post_type’, ‘your-custom-post-type’ ); } } } add_action(‘pre_get_posts’,’search_filter’);
Untested, but I think this will do the trick! <?php // Get date Categories $date_cats = get_categories(array( ‘include’ => ‘1,2,3,4’ )); // Loop through date categories foreach($date_cats as $date_cat) : // Get link of current date category $date_cat_link = get_category_link( $date_cat->cat_ID ); ?> <ul> <li><a href=”https://wordpress.stackexchange.com/questions/140709/<?php echo $date_cat_link; ?>”><?php echo $date_cat->name; ?></a> <ul> <?php // … Read more
Change the cat to the category number you want. For example: “cat” => 2, Or if you know the category name you could also use: “category” =>”category_name”, You should add any of the above two lines in your wp_query arguments like the one in below which is empty: $wp_query = new WP_Query( array( “cat” => … Read more
You don’t need to loop over each category & query them one-by-one, just query them all once: $query = new WP_Query( array( ‘post_type’ => array( ‘service’ ), ‘category__in’ => $ucategory, ‘posts_per_page’ => -1, ) );
I recently ran into a similar issue (rather tackling how to reset slugs that are dirty after importing). This is a snippit of the code I used to reset the slugs: $wpdb->update( $wpdb->posts, array( ‘post_name’ => sanitize_title( $post_to_fix->post_title ) ), array( ‘ID’ => $post_to_fix->ID ), array( ‘%s’ ), array( ‘%d’ ) ); Primarily focus on … Read more
If I understand you well, button ‘Preview Changes’ displays changes made on post/page while you ‘Update’ page/post (save changes). But, ‘View Page’ displays page as is with latest ‘Update’ version. So, if you did not updated page, then you’ll not see what you get when you go to ‘Preview Changes’.