WordPress.org

Ready to get started?Download WordPress

Forums

How to add shortcode to the recent posts page (7 posts)

  1. jemcook
    Member
    Posted 3 years ago #

    I'm completely new to wordpress and floundering slightly so would appreciate some help.

    I have a plugin called Formspring which creates a simple question box. It comes with shortcode that works fine on a random 'page' (p=2) but I want it to appear at the top of the 'recent posts' page (p=1) which doesn't list in my available pages in Dashboard > Pages. (Is this making sense?)

    Can anyone tell me how to get shortcode into the recent posts page?

    with thanks

    Jem Cook

  2. esmi
    Forum Moderator
    Posted 3 years ago #

    Try editing your theme's index.php template file.

  3. jemcook
    Member
    Posted 3 years ago #

    Thanks Esmi, I tried dropping the shortcode direct into the index.php template and into the page.php template but it doesn't parse the shortcode, just prints it out

    Any other ideas out there?

    jem

  4. esmi
    Forum Moderator
    Posted 3 years ago #

    Just released - your home page is an archive (post listings) page. Shortcodes are normally parsed by the_content filter, so they have to be added to the content of a specific page or post. What you could so is try looking for the function that the shortcode calls and see if you can call that in your index.php template.

  5. jemcook
    Member
    Posted 3 years ago #

    Thanks Esmi, I'll give it a go, though I'm not sure my php skills are up to it - I'll keep you posted!

    cheers

    Jem

  6. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

  7. jemcook
    Member
    Posted 3 years ago #

    Thank you alchymyth, that was exactly what I was looking for and it worked perfectly!

Topic Closed

This topic has been closed to new replies.

About this Topic