How can I control multiple editing of wordpress posts?
How can I control multiple editing of wordpress posts?
How can I control multiple editing of wordpress posts?
Yes, you can use template_include or the more specific single_template. Example code: add_filter( ‘single_template’, function( $template ) { $cpt = [ ‘america’, ‘nepal’, ‘norway’ ]; return in_array( get_queried_object()->post_type, $cpt, true ) ? ‘path/to/country-single.php’ : $template; } ); single_template filter runs only for singular queries, so you don’t need to check you are on a singular … Read more
Here is some rough code for you, you may improve the query if you like… By the way selecting post_title and post_status is not neccessary, but useful if you want to ensure that you are returning the right results via conditional logic within your foreach loop. global $wpdb; $results = $wpdb->get_results( ” SELECT ID, post_title, … Read more
this may be called as a bug in get_permalink, but it may not be. I had the same case, and when I tried to echo site_url(); I get the https://… But once I updated the options for siteurl and home to have https get_option( ‘siteurl’ ); get_option( ‘home’ ); get_permalink worked fine. I noticed that … Read more
The solution you used seems correct. But if you still want to know alternatives, here it is: $varname = get_post_meta($post_id, ‘fieldname’, true); echo $varname; $varname will be an array if the last parameter is false and will be the value of metadata field if the last parameter is true. You can use the_field() as well … Read more
Try to update index.php template with new WP_Query arg paged. The code should be: <?php $paged = isset(get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; $news_query = new WP_Query(array( ‘post__not_in’ => array($featured_post->ID), ‘paged’ => $paged )); More info in codex
This could done with couple of ways: With pre_get_posts Small modification will need it like the actual meta value names function alter_edit_php_query_remove_posts($query) { $screen = get_current_screen(); if(is_admin() && $screen->post_type == ‘post’) { $current_user = wp_get_current_user(); $key = ‘nickname’; $single = true; $user_meta_value = get_user_meta( $current_user->ID, $key, $single); $meta_query = array( array( ‘key’=>’_edit_last’, ‘value’=>$user_meta_value, ‘compare’=>’=’, ), … Read more
According to WordPress Codex, pings tells Whether the current post is open for pings. In human words, A ping is a “this site has new content” notification that invites search engine bots to visit your blog. For more info, have a look at this blog article.
This can be achieved easy enough with just CSS. First we are going to add a function that will output a class to the body tag based on what role the user is. Then we will enqueue a stylesheet to show up in the admin. Then use the class in the body to target and … Read more
OH I figured it out. <?php $myvariable = get_the_title( “‘. ”, false ); echo “<a href=”https://wordpress.stackexchange.com/questions/372492/website.com/view/$myvariable”>View on website.com</a>”; ?> Hopefully this helps someone else!