I am attempting to make a page on my site that has a mixture of different kinds of content. So I'd like for the first part to just be the_content, but then beneath it calls to posts under specific categories or months or tags or whatever. I am able to accomplish this easily by creating a custom template for this page, which is how I have it set up now, but if possible I'd prefer to avoid having to edit the template itself just to add new parameters.

So for example if I have headers above ordered lists of specific posts I want Wordpress to display from the loop, I'd like to be able to do this through the visual editor instead of cracking open the code every time. What would be the best possible solution for this? I'm thinking it's probably creating shortcodes in functions.php, but then I don't really know.

Basically: Some sort of intro text, then a header (Featured Posts maybe), beneath which would be whatever posts are in the featured category . . . beneath that another header with different parameters, and on and on. It would get pretty convoluted in the template after a while if I had a bunch of these going.

Hopefully I explained this well enough. Any advice?


I suggest to just append the other things to the content without editing the templates


function hang_my_specific_things_on_the_content($content)
  // shortcode0 is appended before content
  $content = do_shortcode('[shortcode0]').$content;

  // these are appended after the content
  $content .= do_shortcode('[shortcode1]');
  $content .= '<img src="someimage.png" />';
  $content .= do_shortcode('[shortcode2]');

  return $content;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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