Inserting recurring image into each post automatically

  • Anonymous

    #2314

    I would like to put a decorative scroll automatically as a div at the end of each post. I can get it to work with the html tab on a case by case basis (see http://dev.tracydunndesign.com/?page_id=16) but my enduser knows no html and this will not be feasible.

    I would like to modify the css with either custom css or ftp but I’m not sure where to put it. Additionally, I don’t want it to automatically occur when I create a page…it is only a design element for the blog/posts. I appreciate any help you can offer.

    Thanks.

    Josh

    #19737

    Hmm,

    Try inserting the code into the social sharing tab in the graphene options panel. I know this is for social sharing, but I’m sure it can be used for other purposes as well.

    Tick the “show social sharing” checkbox, and UNTICK the “show on pages” checkbox.

    Also select “bottom of posts” for where to display.

    Please let me know how this works for you.

    Mod

    Kenneth John Odle

    #19738

    You can also do this via a Graphene action hook widget area. See this nifty, easy-to-read tutorial: http://blog.kjodle.net/2011/11/04/graphene-action-hook-widgets-an-easy-way-to-modify-your-blog/

    If you are really daring, you can do this via an action hook in your functions.php file, like this:

    add_action ('graphene_after_post_content', 'add_flourish');
    function add_flourish() {
    echo "<p class="flourish" style="text-align:center">
    <img src="http://blog.kjodle.net/wp-content/uploads/2011/09/recipeflourish.gif"
    border="0" style=" -webkit-box-shadow: 0 0 0px #fff;
    box-shadow: 0 0 0px #fff;"
    ></p>";
    }

    to the end of each post. (This was an experiment, btw, and I really need to change it.)

    That’s copied directly from my own functions.php file. It’s what adds the to the end of each post.

    Craig

    #19739

    WOW! Action hook widgets are great! I never knew they were over there. I put the code into the loops.php/graphene_after_post_content widget and it worked like a charm. Ken you are the best. (I was gonna go for the daring option but now I don’t have to.) And the tutorial gives me a great idea for the social media buttons. Keep up the great work!

    Craig

    #19740

    Oops. I spoke too soon. Was so excited to see it drop in there that I didn’t realize that the graphene_after_post_content widget also put content in a page (like a static home page) and I just want the blog/posts to have the decoration. I’ll look at the daring code now.

    Mod

    Kenneth John Odle

    #19741

    Keep reading parts 5 and 6 of that tutorial. Use the is_single() function to get them on just the posts, because the daring portion also adds it to pages.

    And don’t forget to escape any quotation marks in an ECHO statement!

    Craig

    #19742

    I was on it as you were typing. Still not working though… I think the code at the bottom of your blog is missing an else. The front_page version (#1) has:

    if (is_front_page ()) {} else

    {echo “

    But the is_single version (#2) is:

    if (is_single ())

    {echo “

    When I put in the brackets and else I get the results in the right place but it doesn’t appear to be using the is_single function (still showing up on homepage which has no posts.) I know next to nothing about php so I may be making some bad assumptions here.

    FYI I’m just trying to get the “addthis” code to work right now since it should match your code (I put the scroll decoration away for now.) Still same url http://dev.tracydunndesign.com/?page_id=16 . Thanks for your time.

    Craig

    #19743

    Yeah. I’m clueless. You said right in your explanation the difference…in the is_front_page version you want it to write if it is not true, hence the ()) but in the is_single version you want it to write if it is true. Beginning PHP boys should stay out of the sandbox and that’s me. I’ll wait to see what you think.

    Craig

    #19744

    I apologize. It was working when I use your code. I was looking at the page thinking that “each post” on that page would be considered a single post. But because there was more than one post (although separate items) the code returned false. Great for when your blog does excerpts. When I clicked on a post and went to a page that was truly “single” the code worked perfectly. I figuired it out when I went to your book blog to see how it was working so thanks for that link also.

    I came, I learned, I still love the power of Graphene. I’m not sure how you guys feel though about me taking up your time while I get schooled on PHP and posting. I truly appreciate the code. Bonuses: I’ve learned about Action Hooks, AddThis as well as whole slew of conditional tags that I’m sure will come in handy in the future.

    Mod

    Kenneth John Odle

    #19745

    I figuired it out when I went to your book blog to see how it was working so thanks for that link also.

    You’re welcome. I had a lot of fun designing that one and I’m not done yet.

    I’m not sure how you guys feel though about me taking up your time while I get schooled on PHP and posting. I truly appreciate the code. Bonuses: I’ve learned about Action Hooks, AddThis as well as whole slew of conditional tags that I’m sure will come in handy in the future.

    That’s what we’re here for. A willingness to learn on your part makes this job quite enjoyable, because I often have to figure these things out myself and then I get to learn something new. When we share that knowledge, we all grow. Keep asking great questions!

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

You must be logged in to reply to this topic.