Get postlist for each category using query_posts?

Your use of queries is completely wrong, and as stated before, query_posts should never be used. The method you are using to retrieve you category ID’s are also a waste of resources. It would save much more if you knew the ID’s. I would also look at get_categories to retrieve my category details and passing … Read more

Show related posts based of current ACF field name in a single page post (a loop within loop)

You don’t have a meta_value in your query. From your code I can’t tell what you’re doing with the meta values but you should be able to do this: // Store this BEFORE you go into the second loop. $category = get_field(‘category’); // The arguments for the second loop ‘post_type’ => ‘case-studies’, ‘showposts’ => 3, … Read more

wp_insert_post not working fine

As Joshua suggested in his comment, your code isn’t escaped properly. Just before “See Original Article” (in both snippets) you have target=”_blank” on your links with single quotes. Replace that with double quotes target=”_blank”

Adding JS functionality to the Publish button in wp-admin/post.php

Solved it by using a modal box instead of metabox, forcing the users to finish editing the plugin data, before submitting the regular changes to WP. //add_action( ‘add_meta_boxes’, array( $this, ‘add_custom_metabox’ ) ); add_action( ‘media_buttons_context’, array($this, ‘add_custom_media_buttons’ ) ); add_action( ‘admin_footer’, array($this, ‘add_esm_edit’ ) ); These were the lines that were added to the __construct(). … Read more

Get latest post from categories

Ok you can use a foreach loop to return the latest post from each category. Here is how you should do that. <?php $postids = array(); $catids = array( 1, 2, 3 ); // add category ids here. foreach ( $catids as $catid ) { $my_query = new WP_Query( array( ‘cat’ => $catid, ‘ignore_sticky_posts’ => … Read more

How to pick “full/thumbnail” images in the loop?

Try just using the traditional $i iterator (untested) but I can’t see why this wouldn’t work.. <?php $i = 0; while ( have_posts() ) : the_post(); $i++; if ( $i == 1 ): ?> <!– First Post –> <div id=”post”> <a class=”post_image” href=”https://wordpress.stackexchange.com/questions/165568/<?php the_permalink(); ?>” title=”<?php the_title(); ?>”> <?php if ( has_post_thumbnail() ): ?> <?php … Read more

How do I link a Post Type to a Template in Masterplan?

I have never used Masterplan nor Masterpress, however as far as the template hierarchy is concerned, it seems to be no different from the standard WordPress way of dealing with it – See Masterpress Docs I assume that if your (Custom) Post Type is correctly registered through Masterpress interface, it should be registered in WordPress. … Read more