Title: Replace &#8216;Custom Content Shortcode&#8217; with this
Last modified: June 16, 2023

---

# Replace ‘Custom Content Shortcode’ with this

 *  Resolved [Sinkadus](https://wordpress.org/support/users/niwin/)
 * (@niwin)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/replace-custom-content-shortcode-with-this/)
 * Hi
 * I have used the plugin [Custom Content Shortcode](https://wordpress.org/plugins/custom-content-shortcode/)
   to create short codes that automatically write out the name of certain taxonomies
   tied to a CPT (the link is an example of that single CPT). Short codes in my 
   page builder look like this:
 *     ```wp-block-code
       Nummer
   
       [field title]
   
       Konstnär
   
       [field taxonomy=portfolio-category]
   
       Teknik
   
       [if exists]
       [field taxonomy=teknik]
       [else]
       —
       [/if]
   
       Material
   
       [if exists]
       [field taxonomy=material]
       [else]
       —
       [/if]
       ```
   
 * But this plugin has been discontinued do to some security issue, so my question
   is if your plugin could replace this function with similar short codes on my 
   site? I realize I would need to create new short codes and replace the ones in
   use now, but wanted to check in here before I start the process of trial and 
   error.
 * Thanks!
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Freplace-custom-content-shortcode-with-this%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 13 replies - 1 through 13 (of 13 total)

 *  Plugin Author [Eliot Akira](https://wordpress.org/support/users/miyarakira/)
 * (@miyarakira)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/replace-custom-content-shortcode-with-this/#post-16827947)
 * Yes, Loops & Logic is able to do everything that CCS did and more.
 * Your shortcode can be written as a template like this.
 *     ```wp-block-code
       Nummer <Field title />
   
       Konstnär <Taxonomy portfolio-category />
   
       Teknik
   
       <If check="{Taxonomy teknik}">
         <Taxonomy teknik />
       <Else />
         —
       </If>
   
       Material
   
       <If check="{Taxonomy material}">
         <Taxonomy material />
       <Else />
         —
       </If>
       ```
   
 * The syntax is similar, but with some small differences.
 * The above template can be saved as a template post, and loaded with a shortcode
   like `[template name=example]`.
 * For further details, please feel free to join [the discussion forum](https://discourse.tangible.one/).
 *  Thread Starter [Sinkadus](https://wordpress.org/support/users/niwin/)
 * (@niwin)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/replace-custom-content-shortcode-with-this/#post-16827980)
 * Thanks! Will try to replace CCS with this then.
 * Two follow up questions:
    1. With CCS I recently noticed that the short code for “konstnär” (artist)
 *     ```wp-block-code
       [field taxonomy=portfolio-category]
       ```
   
 * Did loop out the name of the artist, but this name was then NOT accessible with
   the search function on my collection page for all the artwork ([https://inuti.se/collection/](https://inuti.se/collection/)).
   Do you think L&L will solve this?
 * 2. Would it be possible to tweak the short codes and make the looped out names
   into links?
 *  Thread Starter [Sinkadus](https://wordpress.org/support/users/niwin/)
 * (@niwin)
 * [2 years, 8 months ago](https://wordpress.org/support/topic/replace-custom-content-shortcode-with-this/#post-17068603)
 * Just checking in, any thoughts of my follow up questions?
 *  Thread Starter [Sinkadus](https://wordpress.org/support/users/niwin/)
 * (@niwin)
 * [2 years, 8 months ago](https://wordpress.org/support/topic/replace-custom-content-shortcode-with-this/#post-17068659)
 * Also, I started a dev site to try this out, and got everything but the portfolio-
   category to work (“displayed below title “Konstnär”). At this link there is first
   the CCS plugin output, and after the L&L output. As you can se, the artist name
   is not visible for the L&L output. Can you advice, something wrong in the code
   you gave me??
 * Thanks!!
 *  Thread Starter [Sinkadus](https://wordpress.org/support/users/niwin/)
 * (@niwin)
 * [2 years, 8 months ago](https://wordpress.org/support/topic/replace-custom-content-shortcode-with-this/#post-17068713)
 * I spoke to soon, actually the ONLY part that worked, of your replacement code,
   was the first one containing the title:
 *     ```wp-block-code
       <Field title />
       ```
   
 * All other parts just didn’t put out anything. I managed to change the next part(
   Konstnär) by myself:
 *     ```wp-block-code
       <Loop taxonomy=portfolio-category post=current>
         <Field title  />
       </Loop>
       ```
   
 * But both of the next taxonomy (if / else) didn’t work, and I can’t figure out
   how to get them to work. Can you advice?
 * [https://dev.inuti.se/collection/fredrik-ehnbom/ic03-2023-006/](https://dev.inuti.se/collection/fredrik-ehnbom/ic03-2023-006/)
    -  This reply was modified 2 years, 8 months ago by [Sinkadus](https://wordpress.org/support/users/niwin/).
 *  Thread Starter [Sinkadus](https://wordpress.org/support/users/niwin/)
 * (@niwin)
 * [2 years, 8 months ago](https://wordpress.org/support/topic/replace-custom-content-shortcode-with-this/#post-17068800)
 * Update: with this code I can loop out the taxonomy for “Teknik” and “Material”,
   but I can’t get it to work inside an “if / else query”. Can you hava a look?
 *     ```wp-block-code
       <Taxonomy teknik>
         <Term title /></Taxonomy>
       ```
   
 *  Thread Starter [Sinkadus](https://wordpress.org/support/users/niwin/)
 * (@niwin)
 * [2 years, 8 months ago](https://wordpress.org/support/topic/replace-custom-content-shortcode-with-this/#post-17082498)
 * Sorry for nagging, but any chance I can get any help with making “if/else” to
   work?
 *  Thread Starter [Sinkadus](https://wordpress.org/support/users/niwin/)
 * (@niwin)
 * [2 years, 7 months ago](https://wordpress.org/support/topic/replace-custom-content-shortcode-with-this/#post-17096046)
 * Okay, so this is from your documentation about if/else:
 *     ```wp-block-code
       <If subject comparison value>
       The condition is true.
       <Else />
       The condition is false.
       </If>
       ```
   
 * And this is my code (that you provided, and that is not working):
 *     ```wp-block-code
       <If check="{Taxonomy teknik}">
         <Taxonomy teknik />
       <Else />
         —
       </If>
       ```
   
 * I’m pulling my hair here, why is the if/else part not working? Can you please
   please advice.
 *  [Ben @ Team Tangible](https://wordpress.org/support/users/bentangible/)
 * (@bentangible)
 * [2 years, 7 months ago](https://wordpress.org/support/topic/replace-custom-content-shortcode-with-this/#post-17096461)
 * Hi [@niwin](https://wordpress.org/support/users/niwin/), kudos on doing some 
   serious troubleshooting there! Sorry our folks ghosted you on this thread after
   Eliot’s initial reply.
 * I think the source of this mix-up is probably the fact that Eliot introduced 
   the concept of the [Taxonomy loop shortcut](https://docs.loopsandlogic.com/docs/learning-guides/dynamic-tags/taxonomy-term/)
   which can be useful and succinct, but kind of obscures what’s going on. If you’re
   just starting out, that obscuration can make it a little tough to figure out 
   what’s going on and troubleshoot it. I’d recommend playing around with the `Loop`
   tag syntax rather than the `Taxonomy` tag for now.
 * It seems like what you’re trying to do with `<If check="{Taxonomy teknik}">` 
   is to check if a taxonomy term loop exists and, if so, display the term(s). I
   see that Eliot suggested that syntax, but if I’m understanding the docs right,
   the `Taxonomy` tag is a “shortcut for creating a taxonomy term loop” so you couldn’t
   just use `Taxonomy teknik` as-is. Since Eliot suggested it, I imagine it’s an
   undocumented feature, but I couldn’t help with that since only Eliot knows how
   that works haha!
 * In any case, I’d ignore that shortcut for now and take a look at the `Loop` tag
   documentation, specifically the feature that allows you to [check whether a loop exists](https://docs.loopsandlogic.com/docs/learning-guides/dynamic-tags/loop/features/exists).
   Using that non-shortcut syntax, you’d end up with a conditional part of your 
   template that probably looks something like this:
 *     ```wp-block-code
       <If loop exists taxonomy=portfolio-category post=current>
         <Loop>
           <Field title  />
         </Loop>
       <Else />
         Do something else.
       </If>
       ```
   
 * What I’m doing there is instead of just directly looping through the taxonomy
   terms as you mentioned you were able to successfully do with `<Loop taxonomy=
   portfolio-category post=current>`, I’m instead passing that same information 
   to the `If` tag to first check if the loop returns anything and if it does, then
   I actually start the loop and display stuff, and do something else if there’s
   no data in the loop.
 * Hope that helps get you back on track with this!
 * By the way, if you need help with other issues down the road, another option 
   is to make a post on the [official L&L forum](https://discourse.tangible.one/c/loops-and-logic/9).
   It’s a much more active community so you might get faster support there on future
   support requests.
 *  Thread Starter [Sinkadus](https://wordpress.org/support/users/niwin/)
 * (@niwin)
 * [2 years, 7 months ago](https://wordpress.org/support/topic/replace-custom-content-shortcode-with-this/#post-17096876)
 * Thank you! Also, I was sooo close to cracking it myself, since my solution to
   get “konstnär” to work was this:
 *     ```wp-block-code
       <Loop taxonomy=portfolio-category post=current>
         <Field title  />
       </Loop>
       ```
   
 * And I tried to fit this within if/else. Probably just missed the “exists” variable…
 * Anyway – big thanks! Also: did you see my initial follow up questions, regarding
   if there is a variable to have the output as links, and my problem with konstnär
   looping out okay, but not beeing visible for the search tool…
 *  [Ben @ Team Tangible](https://wordpress.org/support/users/bentangible/)
 * (@bentangible)
 * [2 years, 7 months ago](https://wordpress.org/support/topic/replace-custom-content-shortcode-with-this/#post-17096907)
 * > if there is a variable to have the output as links, and my problem with konstnär
   > looping out okay, but not beeing visible for the search tool
   >  [@niwin](https://wordpress.org/support/users/niwin/)
 * Keep in mind that [variables](https://docs.loopsandlogic.com/docs/reference-guides/terminology-definitions/variable)
   are their own thing in L&L and in any templating/programming language. In the
   case of L&L, variables are handled by the [Set and Get tags](https://docs.loopsandlogic.com/docs/learning-guides/dynamic-tags/set-get/).
   But I don’t think that relates to what you’re actually asking about.
 * It sounds like you’re hoping to work with a URL _field _and make that work as
   a link. You may want to read about [how loops work](https://docs.loopsandlogic.com/docs/learning-guides/dynamic-tags/loop/)
   as a refresher but basically, in your case, once you’ve opened your taxonomy 
   term loop, you can display [any fields you want that are supported by that loop type](https://docs.loopsandlogic.com/docs/learning-guides/dynamic-tags/loop/taxonomy-term),
   like the title as you’ve already done, or the URL of the term’s archive page.
   Remember that L&L is just an extension of HTML, so you’d just use regular HTML
   syntax and fill the attribute values dynamically with L&L’s dynamic tags. The
   [getting started guide](https://docs.loopsandlogic.com/docs/getting-started/loops-and-logic/intro)
   goes through that along with some syntax tips if you need a refresher.
 * In your case, it might look like this:
 *     ```wp-block-code
       <If loop exists taxonomy=portfolio-category post=current>
         <Loop>
           <a href="{Field url}" ><Field title  /></a>
         </Loop>
       <Else />
         Do something else.
       </If>
       ```
   
 * As far as data “not being visible for the search tool,” I don’t think that’s 
   something L&L can help you with. L&L doesn’t create data, it just allows you 
   to adjust how it’s displayed. If your taxonomy terms aren’t showing up in your
   search, it sounds like you’ll want to modify your site’s search settings.
    -  This reply was modified 2 years, 7 months ago by [Ben @ Team Tangible](https://wordpress.org/support/users/bentangible/).
      Reason: added a note about search functionality
 *  Thread Starter [Sinkadus](https://wordpress.org/support/users/niwin/)
 * (@niwin)
 * [2 years, 7 months ago](https://wordpress.org/support/topic/replace-custom-content-shortcode-with-this/#post-17097067)
 * Yes, that did the trick. Amazing support for an amazing plugin. Will immediately
   leave 5 star review.
 * Thank you so so much!
 *  Plugin Author [Tangible](https://wordpress.org/support/users/tangibleinc/)
 * (@tangibleinc)
 * [2 years, 7 months ago](https://wordpress.org/support/topic/replace-custom-content-shortcode-with-this/#post-17097277)
 * For the search results, keep in mind that search systems generally rely on modifying
   the main query on the page (the default loop of that page essentially). That 
   means that if you create a new loop, different from the main loop, it likely 
   won’t be impacted by search. Luckily with L&L you can just output the main loop
   by using the <Loop> tag without specifying a loop type. For a more specific example
   you can check out our guide on getting it to work with FacetWP which should be
   quite similar regardless of the search system you use: [https://docs.loopsandlogic.com/docs/how-to/facet-wp-loop-tag/](https://docs.loopsandlogic.com/docs/how-to/facet-wp-loop-tag/)

Viewing 13 replies - 1 through 13 (of 13 total)

The topic ‘Replace ‘Custom Content Shortcode’ with this’ is closed to new replies.

 * ![](https://ps.w.org/tangible-loops-and-logic/assets/icon.svg?rev=2535522)
 * [Loops & Logic](https://wordpress.org/plugins/tangible-loops-and-logic/)
 * [Support Threads](https://wordpress.org/support/plugin/tangible-loops-and-logic/)
 * [Active Topics](https://wordpress.org/support/plugin/tangible-loops-and-logic/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/tangible-loops-and-logic/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/tangible-loops-and-logic/reviews/)

## Tags

 * [short codes](https://wordpress.org/support/topic-tag/short-codes/)
 * [taxonomies](https://wordpress.org/support/topic-tag/taxonomies/)
 * [taxonomy](https://wordpress.org/support/topic-tag/taxonomy/)

 * 14 replies
 * 4 participants
 * Last reply from: [Tangible](https://wordpress.org/support/users/tangibleinc/)
 * Last activity: [2 years, 7 months ago](https://wordpress.org/support/topic/replace-custom-content-shortcode-with-this/#post-17097277)
 * Status: resolved