Can you add short codes to blog posts?

Community Forums Forums Design Tips and Tricks Can you add short codes to blog posts?

This topic is: not resolved

This topic contains 4 replies, has 3 voices, and was last updated by  WoodlandCoyote 1 year, 6 months ago.

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

    WoodlandCoyote
    Participant
    Post count: 171

    I’d like to add a symbol at the end of each post. It will appear on the same line as the last word and the ending punctuation.  *

    Just like the asterisk above.

    Instead of using span class to style it and adding the link, it would be awesome if I could create a shortcut. Can I make my own short code and use it in my blog post?

    Thanks!

    #33801

    Nick Davis
    Participant
    Post count: 44

    Hi – yes, you can make your own custom shortcodes in WordPress, more info here:

    http://codex.wordpress.org/Shortcode_API

    If you know you’re always going to put it at the end of EVERY post though you might be best adding it automatically at the end of every post via your theme. (For example you could create a function (placed in your functions.php file or your single.php template file) that would automatically add your asterisk at the end of every blog post).


    @NickCDavis. WordPress developer & Genesis fan boy living in Italy.
    Don’t want to set up your theme yourself? Try my new ThemeValet service.

    #33802

    WoodlandCoyote
    Participant
    Post count: 171

    That’s a great idea. I’ll create a function for this instead of a short code.

    I’d prefer to add it to my functions file, but I haven’t done this before. Do you know of any helpful instructions on how to do this? I thought I saw a tutorial on StudioPress, but I can’t find it.

    Thank you.

    #33816

    marybaum
    Participant
    Post count: 129

    This would get an asterisk on the line after every post – I think.

    Add filter (‘genesis_after_post’, ‘genesis_add_sigchar’);
    function genesis_add_sigchar () {
    echo “*”;
    }

    People want me to start dinner, or I’d mess with it some more – what you probably want is something that removes the last , adds the asterisk and then puts back the .

    So instead of just the echo statement, delete and then echo.

    I called this a filter, but maybe it’s an action – I’m not too clear on the difference.

    Hope this helps, or gives someone with better php something to correct.

    MB


    Be it ever so run down, there’s no place like FriendFeed. ;-)

    #33849

    WoodlandCoyote
    Participant
    Post count: 171

    Thanks, Mary!

    I don’t think this will put the symbol at the end of the last sentence in my posts. But I’ll play around with the code and see if I can figure this out. There are examples of functions that place signature lines at the end of a post, but I need this to appear directly in the post itself.

    :)

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

You must be logged in to reply to this topic.