Saving custom fields to a custom taxonomy
Correct me if I’m wrong, but isn’t what you’re looking for the wp_set_object_terms function?
Correct me if I’m wrong, but isn’t what you’re looking for the wp_set_object_terms function?
They are actually doing this is one loop, here’s an example to show similar structure. <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <div class=”article”> <div class=”left”> <?php the_post_thumbnail( $size, $attr ); ?> <?php get_the_category(); ?> </div><!– end left side –> <div class=”right”> <?php the_excerpt(); ?> </div> <!– end right … Read more
Place the following code in your theme functions.php file. function one_random_post_on_home_page( $query ) { if ( ! ( $query->is_home() && $query->is_main_query() ) ) return; $query->set( ‘orderby ‘, ‘rand’ ); $query->set( ‘posts_per_page’, 1 ); } add_action( ‘pre_get_posts’, ‘one_random_post_on_home_page’ ); I’m assuming when you say index.php you mean your blogs home page. The index.php file in your … Read more
The ../page/X structure ties to pagination, not to post names. I’m sure you could change them but I’m not sure how deep the effects of the change would be. Have you thought about an alternate solution? Name each post your chapter name Forward Chapter 1 Chapter 2 Add a plugin that adds previous / next … Read more
Make sure your user has permission to publish. Some WordPress setups users such as authors do not have permission to publish posts directly, instead they can submit them for review for an admin to review and decide whether the post should be published or not. It is not a great idea to use an administrator … Read more
Stewart, there is a simple way to make the admin area present more simply with two plugins. You can certainly optimize the output of what these plugins will give you, but they can at least get you started. First, you want to create a new custom post type. Custom Post Types UI is a simple … Read more
Based on your comment clarifying what you want to achieve, it appears you want to display the first 60 characters of your post not including any shortcodes. To do this you can use the strip_shortcodes() function. Rewritten with that, your code will look like this: $content = strip_shortcodes(get_the_content()); $content = apply_filters(‘the_content’, substr($content, 0, 60) ); … Read more
Have you looked into expire plugins ? https://wordpress.org/plugins/search.php?q=expire finally wordpress.org/plugins/post-expiring seems to have done the job.
If what you want is is a full page refresh then you don’t need ajax at all and inserting the htt-equip html meta will do the trick <meta http-equiv=”refresh” content=”5″ > (content is time in seconds IIRC) You just hook on wp_head and insert it. function wpse_228671_wp_head() { echo ‘<meta http-equiv=”refresh” content=”5″ >’; } add_action(‘wp_head’,’wpse_228671_wp_head’);
Try This Code $latest = new WP_Query( array ( ‘post_type’ =>’your-post-type-name’, ‘post_status’ =>’publish’, ‘orderby’ => ‘rand’, ‘posts_per_page’ => 3 )); while ( $latest -> have_posts() ) : $latest -> the_post(); echo the_ID(); endwhile;