Add view to admin menu to filter for specific criteria ( If post is child of specific Parent )

You can “load the pages” via the pre_get_posts action, like so: add_action( ‘pre_get_posts’, ‘my_admin_pre_get_posts’ ); function my_admin_pre_get_posts( $q ) { // Check whether the filter was clicked. if ( isset( $_GET[‘post_parent’] ) ) { $screen = is_admin() ? get_current_screen() : null; // And that it’s the edit pages page. if ( $screen && ‘edit-page’ === … Read more

Change post value in WordPress

In order to add a new value and keep the previous values, you need to use add_post_meta() instead of update_post_meta(): $post_id = get_the_ID(); $new_post_desc=”the new value here”; // add_post_meta() add a new field with the same name // and keeps previous values on the database add_post_meta( $post_id, ‘post_desc’, $new_post_desc ); Then, you can use get_post_custom_values() … Read more

Please I want to prefix my WP posts title according to each category

You have already mentioned the function wp_title(). Right before outputting the title, it passes its value through the filter wp_title, which can be used here to prepend with additional information. add_filter(‘wp_title’, ‘WPSE_20181106_prepend_title’, 10, 3); function WPSE_20181106_prepend_title($title, $sep, $seplocation) { // not a single post if (!is_singular(‘post’)) { return $title; } // IDs of categories that … Read more

How to display particular categorie’s post which associated to specific user?

How are you associating users to a post? If you meant users as post authors you can try pre_get_posts hook. function user_author_pre_get_posts( $query ) { $user_id = get_current_user_id(); // Get logged in user ID or pass specific user ID here if ( ( $query->is_author() || $query->is_category() ) && $query->is_main_query() ) { $query->set( ‘author__in’, $user_id ); … Read more

Mix post date with post meta value using WP_Query

Finally I’ve decided to use custom sql query with get_results method. $query = “SELECT SQL_CALC_FOUND_ROWS p.*, IFNULL(m2.meta_value, p.post_date_gmt) as zen_date FROM {$wpdb->posts} p LEFT JOIN {$wpdb->postmeta} m1 ON (p.ID = m1.post_id AND m1.meta_key = ‘is-exclude’) LEFT JOIN {$wpdb->postmeta} m2 ON (p.ID = m2.post_id AND m2.meta_key = ‘is-push’) WHERE p.post_type=”post” AND p.post_status=”publish” AND m1.post_id IS NULL … Read more

how can i fix my display post in my index.php

you’re using commas as concatenators you’re echoing the_title() and the_post_thumbnail() (use get if you’re echoing) your the_post() was at the bottom <div class=”Jobs”> <?php if(have_posts()) { while (have_posts()) { the_post(); echo'<div class=”info_Job”>’; echo ‘<h2>’.get_the_title().'</h2>’; echo get_the_post_thumbnail().'</div>’; } } ?> </div> If you don’t want to use get but directly output do this instead: <div class=”Jobs”> … Read more

getting custom post by tag

Try this code as by using tag_slug__in, not tag. $search_videos = array( ‘posts_per_page’ => -1, ‘post_type’ => ‘videos’, ‘tag_slug__in’ => $search_query ); $new_query = new WP_Query( $search_videos ); $search_videos_posts = $new_query->posts;

post and page and custom post type

There are many ways of achieving the same or similar outcomes when it comes to WordPress. It is difficult to answer Question:3 without a full overview or gaining more detail into your project. You are correct in your assumptions for question 1 and 2 for the purposes of this context. I’m sure there are many … Read more

how to put post customized in page

Create a custom template page for the archive food-archive.php and then query the posts Learn about custom templates: https://developer.wordpress.org/themes/template-files-section/page-template-files/ Learn about posts queries: https://developer.wordpress.org/reference/functions/query_posts/ the query should pull through permalink, post thumbnail, title, and details (which would possibly your excerpt as per your image)