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.
<?php 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?