[CATEGORY] but without the link.

WordPress Business Themes Forums Responsive Themes Directory Theme [CATEGORY] but without the link.

Discontinued - The forum content is out of date. For theme support please use our support desk here.

[CATEGORY] but without the link.

August 6, 2014
yogev yogev
  • yogev
    yogev
    Newbie 48 points

    in:
    admin > page setup > content page > Search Results Layout:
    i want add:
    [CATEGORY] but without the link.

    somebody?

    August 6, 2014 at 1:44 am
  • Mark Fail
    Mark Fail
    Super Guru 12,814 points

    this shortcode includes the link built in, there is none without a link.

    August 6, 2014 at 4:55 am
  • CodersPress.com
    CodersPress.com
    Elite Member 524 points

    Place this under the current Search Results Layout.

    It will replace the link with just text of the category name.

    You might want to style it? but this does what you asked.

    <script>
    jQuery('.wlt_shortcode_category').text(function( i, text ) {
    return text;
    });
    </script>
    August 6, 2014 at 5:28 am
  • Mark Fail
    Mark Fail
    Super Guru 12,814 points

    :) That’s one way of doing it :)

    August 6, 2014 at 7:33 am
  • Clive
    Clive
    Super Guru 1,818 points

    Gotta love js ๐Ÿ˜‰

    August 6, 2014 at 8:04 am
  • yogev
    yogev
    Newbie 48 points

    ok,
    I want to show “[Category]” but connection to “[link]”.
    But when I put the script you brought that does not work.

    this is the code now:
    <h1><a href ="[LINK]">[CATEGORY]</a></h1>

    August 9, 2014 at 1:02 am
  • CodersPress.com
    CodersPress.com
    Elite Member 524 points

    Hopefully this is what you wanted… it only took 3 explanations in two threads ๐Ÿ˜†

    <script>
    var plainText = jQuery('.wlt_shortcode_category').text();
    jQuery('.wlt_shortcode_category').replaceWith("<a href='[LINK]'>"+plainText+"</a>") 
    </script>

    I removed the h1 tags as it throws your link out of sync with the original line, and because the font size is different… put them back if you want of course and style to your needs.

    August 9, 2014 at 8:05 am
    This reply was awarded the best answer by the topic poster.
  • yogev
    yogev
    Newbie 48 points

    tnx ! amazing code ๐Ÿ˜‰

    August 9, 2014 at 2:24 pm
  • yogev
    yogev
    Newbie 48 points

    <script>
    var plainText = jQuery(‘.wlt_shortcode_category’).text();
    jQuery(‘.wlt_shortcode_category’).replaceWith(““+plainText+”“)
    </script>

    it work great , but if i want the same code with original link ?

    August 14, 2014 at 1:47 pm
  • CodersPress.com
    CodersPress.com
    Elite Member 524 points

    Not sure what you mean, type out an example of what you need.

    The original shortcode would have produced this:

    <span class="wlt_shortcode_category">
        <a rel="tag" href="http://yoursite.com/listing-category/category_name/">category_name</a>
    </span>
    August 14, 2014 at 2:06 pm
  • yogev
    yogev
    Newbie 48 points

    thank you so much! pro comments!!

    August 14, 2014 at 8:56 pm
Viewing 11 posts - 1 through 11 (of 11 total)

Didn't find what you were after?

Chat with us now

or contact our support team