Support » Theme: Customizr » Creating shortcode for text slug

  • Resolved chappie


    I would like the same slug of text (a 5-line list which will occasionally need to be updated) to appear at the end of the text on every static page except the home page (ie not on post pages).

    I don’t think I can use a widget since these have to be placed in a fixed location on the page and the position of my text slug will vary depending on how long the main content is on each page.

    So is a shortcode my best bet? I couldn’t find a snippet which matches my need; and when I did a Google search of this forum for “shortcode” only 3 matches were found, none of them relevant.

    If so, I would prefer to try coding this myself rather than install another plugin to do just one task. I’ve read the WP shortcode Codex and other references but being php-illiterate, I couldn’t understand them.

    Can anyone please help? TIA.

Viewing 8 replies - 1 through 8 (of 8 total)
  • I’m sure we can produce a php solution. But if you want to stick with your php illiteracy, then a plugin is the most likely way to go.

    One plugin I use which I find very powerful is Tablepress. You’ll be able to maintain your list in it, and by using TablePress Extension: Single Cell Content Shortcode, you’ll add a shortcode to Pages you want, and any changes to the 5-lines need to be made once in the Table without changing any code in the relevant Pages.

    Thanks Dave- I’ll see if I can make further progress without installing another plugin.

    I can always manually add a text slug to the bottom of every page but there are 30+ pages so any updates or amends will be non-trivial…

    You can always use customzir “__after_content” action hook (or wordpress filter “the_content”, if you want that text inside the content), but I don’t know if I really got your goal 😀

    d4z_c0nf – if I were to use a hook, where would I put the text slug – in a widget? It needs to be reasonably accessible for future editing by someone who knows even less than me…but I think she will be able to handle a widget.

    What I’m trying to achieve is a slug of text which, manually created, would simply be the last div on every page – ie its position on the page would be determined by the position/length of the previous div.

    Let’s say you create a widget area (like “after the headear” on themesandco snippets ), and you put there a text widget.
    Then you can easily display it with the same code using __after_content instead of __after_header and with a check if is a page or a post (

    Thank you d4z_c0nf – I’ll play around with that.

    Thinking further about this, I might instead want to put a menu in this __after_contentwidget – just horizontal wrapping lines of around 30 href titles. I’m assuming I’ll be OK so far…?

    But the problem I can foresee is that I would want to deactivate the href for the link the reader is on – which would mean 30 different tweaks, one for each page. If I can’t automate that somehow, I might as well do the job manually I suppose…

    Well when you use a wordpress menu, you can see that the class of the item related to the current page changes, “current-menu-item”, “current-menu-ancestor” (if is an anchestor of the page), and so on. So you can hide it with css,,

    Hmmmmm…I’m liking this more and more. Off to play…

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Creating shortcode for text slug’ is closed to new replies.