A question about shortcodes?

Community Forums Forums General Discussion A question about shortcodes?

This topic is: resolved

This topic contains 4 replies, has 2 voices, and was last updated by  IttyBiz Ninjas 1 year, 10 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #19135

    IttyBiz Ninjas
    Participant
    Post count: 11

    Hey there!

    We were looking for a way to inset PHP/HTML into certain posts and pages in the Minimum theme and we’re not sure if shortcodes is how it’s done.

    Basically, what we used to have on our old theme was a setup where we could put some HTML in a file, and then put at the end of a post a code like [iba file=”whatever.php”] and it would insert the contents (usually an ad) into that file at the end of the post.

    This way we could change what was in that file at any time and it would carry through to the pages with that ad, but we could have as many of those as we wanted, so we could show different targeted ads on different posts.

    Does something like that exist inside Genesis?  Or is there a plugin that does that?

    Thanks in advance for any help!


    The super secret,
    but ever-effective
    IttyBiz ninjas

    #19171

    braddalton
    Participant
    Post count: 10679

    Try the Genesis Simple Hooks plugin with a conditional tag

    You could also add widgets and use the Widget Logic plugin with a rotating banner plugin which offers a widget


    #19320

    IttyBiz Ninjas
    Participant
    Post count: 11

    Hey Brad!

    Thanks so much for the tip – we installed Genesis Simple Hooks plugin and we successfully put in a hook in the Post/Page hook section.

    We have a follow-up question that we hope can get an answer, too. :)

    We’ve created a new page template (basically the same as the blog page template) that’s for our Newsletter Archive, and we’re not sure how to get the hook to only show on pages with *that* template.

    When we added HTML code to the Post/Page hook section it showed up on *every* post/page section, and we just want it to show up on these particular pages with this new template.

    We’ve tried searching on the answer but we couldn’t find exactly how to do this – do you have any advice?

    Thanks!

     


    The super secret,
    but ever-effective
    IttyBiz ninjas

    #19321

    braddalton
    Participant
    Post count: 10679

    Easily fixed using a conditional tag.

    Example:
    [php]
    <?php if (is_page(200) ) { ?><p>HTML-Code-Here</p><?php } ?>
    [/php]

    or
    [php]
    <?php is_page_template( ‘newsletter.php’ ) ) { ?><p>Insert-Code-Here</p><?php } ?>
    [/php]

    Or you can create a widget section in that hook location and use the widget logic plugin with the conditional tag for that page i.d. or include the conditional in the code for the widget area.

    Code Snippets http://pastebin.com/u/braddalton
    http://codex.wordpress.org/Conditional_Tags


    #19627

    IttyBiz Ninjas
    Participant
    Post count: 11

    Thanks so much, brad!

    That totally did the trick.  It was indeed easy with your help. :)

    You’re the man!


    The super secret,
    but ever-effective
    IttyBiz ninjas

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.