I need to have several custom meta boxes in the post edit screen that allows the client to choose a particular page for the allocation of a blockquote.

ATM I have a template part called blockquote.php, that is called on various standard templates, for example, single.php calls it via a conditional.

if ( in_category( 'nen-news' ) || in_category( 'news' ) )  : ?>
<?php get_template_part( 'template-parts/newsletter-signup-sidebar' ); ?>
<?php get_template_part( 'template-parts/blockquote' ); ?>
<?php else : ?>

<?php get_template_part('template-parts/blockquote'); ?>
<?php get_template_part('template-parts/get-in-touch' ); ?>

<?php endif ?>

There are several files that call the template part blockquote.php .

The client requires 4 custom fields - title, quote, author and display page.

I can do the title, quote & author easily using custom meta boxes and the post_meta data.

The problem I have is that they also want to be able to choose a particular page to place the blockquote on. They want a dropdown selectbox, in the post edit screen with all the pages where a blockquote appears.

My problem is, how do I populate the select dropdown with the right choices.

How can I get the information from the WordPress core to populate the select dropdown as the site is dynamic and they will be adding pages that will have the template part blockquote.php - so I cant just build a static dropdown - it needs to auto populate based on pages that display a blockquote.

When they add a new page that displays a blockquote, this then needs to be added to the select box as an option for placement.

This is stumping me - any ideas?

  • This is pretty complex, I think you need to parse the content and store it in a transient. Why don't you just make a taxonomy called blockquotes and ask them to click it, or have some javascript do it for them.
    – Wyck
    Feb 28, 2014 at 1:44
  • 1
    I am a bit confused with the question. Why not create a custom post type called quotes? Then you can add all your quotes there. In the other page you can a drop-down with the title of all quotes in that custom post type.
    – gdaniel
    Feb 28, 2014 at 1:45
  • I am confused also. I suspect the approach itself is flawed but I can't quite work out what you are trying to accomplish.
    – s_ha_dum
    Feb 28, 2014 at 2:00
  • Thanks for your replies, I am trying to accomplish what the client is asking me for!! He wants to be able to write a testimonial blockquote, be able to give it a title, content and then an author. Then he also want to choose which page it goes on. I think the best approach here would be something along the lines of what gdaniel has proposed. Its more bottom up than top down. Which has miffed me because I usually like to most things bottom up - but as this is an addition to a 99% finished site my mindset is more 'tacking-on' that 'building-in'. Any discussion on gdaniel's idea? Feb 28, 2014 at 19:32
  • @user1683285 - I typically user the plugin advanced custom fields to handle this kind of things. Create a custom post type first for all your quotes. Create a drop-down custom field that shows in every page edit. The plugin will allow you to build a drop-down of all posts in a custom post type automatically, saving you tons of time. Then it's just a matter of selecting which quote you want to show in each page. In your page template you can have a if statement. If custom_field == "" - don't print blockquote div.. else echo custom_field.
    – gdaniel
    Feb 28, 2014 at 22:25

1 Answer 1


This sounds like the first step of a problem I'm currently trying to figure out (specifically, I'm working on populating one select based on a post type, then populating a second select based on the post type selected). If blockquote is a post type,I think it'll work.

Here's what I've worked out as part of my own project:

function fetch_ID_list($type) {
    // This function is known for corrupting the post ID for some reason.  Therefore I copy $post to $temp and reassert it prior to returning
    global $post;
    $temp = $post;

    $query_params = array(
        'orderby' => 'title',
        'order' => 'ASC'

    $all_posts = waka_taxonomy_query($type, -1, $query_params);

    $return = array();

    if($all_posts->have_posts()) {
        while ($all_posts->have_posts()) {

            $return[] = get_the_ID();

    $post = $temp; // Reassert original post

    return $return;

From there you can take the array provided and populate a select

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.