0

I have to build a custom functionality based on custom fields.

I have a sidebar that displays a blockquote testimonial. At the moment this is achieved by giving a post a category of block quote. But the customer wants to make it more user friendly by adding a field for the title, the quote and an author. I can do this by adding custom meta boxes and using the post meta data. But they also want to be able to choose the page it will be displayed on.

Currently the block quote is a template part, and is called via a conditional in various template files. So it is not known in advance the pages it will appear as content grows and different pages are added.

I will need a select box in the post edit screen that has been auto populated with all the current pages that display a block quote. But I am at a loss how to populate this select box as its not known in advance which pages end up with a block quote on them.

I was thinking about finding a way to every time a page displays the block quote this info is logged and then used to populate the select box, but I am not that great with custom php, I am a front end Dev that is learning how to build WordPress back end. I have good HTML CSS JavaScript, but my php knowledge is limited to simple conditionals and the custom functions of WordPress.

I assume this will be hooking into a filter somewhere but I can't see where.

Any help on this would be much appreciated.

1 Answer 1

0

Ok so i am not sure if i am able to get your question properly -- so i am trying to list down what i understand.

1: You can create a custom post type (for testimonials) where your client/admin can fill out title/description/author name. 2: To be able to display them on specific pages - you can create a template file for example -testimonials.php and call the standard WordPress loop to display the content + call this custom post type -where and how you would want to display it.

to know how to create a custom theme page http://codex.wordpress.org/Page_Templates

and to know more about how to create custom post type http://codex.wordpress.org/Post_Types

Hope it helps

3
  • Thanks robin. Yes, I can already do the metaboxes and then use that data to populate them template part. My issue is they also want to choose the actual page it will be displayed on. As the site is dynamic, and pages/posts added all the time - how can I know in advance what pages will have a blockquote displayed as I need a drpdown select box in the post edit screen so they can pick a page to display it on. I can't think of a way to auto populate this select box. Commented Feb 27, 2014 at 12:42
  • so where exactly are you struck? because from your question it fells like you could not do follow how to get it working
    – robin
    Commented Feb 27, 2014 at 12:45
  • I need to be able to have a select box on the post edit screen with a select dropdown of pages that have a blockquote on them so they can choose a placement for it. I cant figure out how to populate this select box as pages will be added and I cant see how to add new pages to the select box automatically. Commented Feb 27, 2014 at 14:58

Your Answer

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

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