Title: Creating shortcode for text slug
Last modified: August 21, 2016

---

# Creating shortcode for text slug

 *  Resolved [chappie](https://wordpress.org/support/users/chappie/)
 * (@chappie)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/creating-shortcode-for-text-slug/)
 * 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)

 *  [rdellconsulting](https://wordpress.org/support/users/rdellconsulting/)
 * (@rdellconsulting)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/creating-shortcode-for-text-slug/#post-4853809)
 * 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](https://wordpress.org/plugins/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.
 *  Thread Starter [chappie](https://wordpress.org/support/users/chappie/)
 * (@chappie)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/creating-shortcode-for-text-slug/#post-4853837)
 * 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…
 *  [Rocco Aliberti](https://wordpress.org/support/users/d4z_c0nf/)
 * (@d4z_c0nf)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/creating-shortcode-for-text-slug/#post-4853854)
 * 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 😀
 *  Thread Starter [chappie](https://wordpress.org/support/users/chappie/)
 * (@chappie)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/creating-shortcode-for-text-slug/#post-4853857)
 * 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.
 *  [Rocco Aliberti](https://wordpress.org/support/users/d4z_c0nf/)
 * (@d4z_c0nf)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/creating-shortcode-for-text-slug/#post-4853858)
 * Let’s say you create a widget area ([like “after the headear” on themesandco snippets](http://www.themesandco.com/snippet/add-widget-area-header/)),
   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 ([http://codex.wordpress.org/Function_Reference/is_singular](http://codex.wordpress.org/Function_Reference/is_singular)).
 *  Thread Starter [chappie](https://wordpress.org/support/users/chappie/)
 * (@chappie)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/creating-shortcode-for-text-slug/#post-4853864)
 * 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_content`
   widget – 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…
 *  [Rocco Aliberti](https://wordpress.org/support/users/d4z_c0nf/)
 * (@d4z_c0nf)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/creating-shortcode-for-text-slug/#post-4853870)
 * 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,,
 *  Thread Starter [chappie](https://wordpress.org/support/users/chappie/)
 * (@chappie)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/creating-shortcode-for-text-slug/#post-4853874)
 * 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.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/customizr/4.4.24/screenshot.png)
 * Customizr
 * [Support Threads](https://wordpress.org/support/theme/customizr/)
 * [Active Topics](https://wordpress.org/support/theme/customizr/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/customizr/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/customizr/reviews/)

## Tags

 * [chappie](https://wordpress.org/support/topic-tag/chappie/)
 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)
 * [text](https://wordpress.org/support/topic-tag/text/)

 * 8 replies
 * 3 participants
 * Last reply from: [chappie](https://wordpress.org/support/users/chappie/)
 * Last activity: [12 years, 1 month ago](https://wordpress.org/support/topic/creating-shortcode-for-text-slug/#post-4853874)
 * Status: resolved