Ask the community

This is a community support forum where you can ask
questions and interact with other PremiumPress Customers.

[CATEGORY] but without the link.

  • yogev
    yogev
    Newbie 48 points
    August 6, 2014 at 1:44 am

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

    somebody?

  • Mark Fail
    Mark Fail
    Super Guru 12,819 points
    August 6, 2014 at 4:55 am

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

  • CodersPress.com
    CodersPress.com
    Elite Member 524 points
    August 6, 2014 at 5:28 am

    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>
  • Mark Fail
    Mark Fail
    Super Guru 12,819 points
    August 6, 2014 at 7:33 am

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

  • Clive
    Clive
    Super Guru 1,818 points
    August 6, 2014 at 8:04 am

    Gotta love js ๐Ÿ˜‰

  • yogev
    yogev
    Newbie 48 points
    August 9, 2014 at 1:02 am

    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>

  • CodersPress.com
    CodersPress.com
    Elite Member 524 points
    August 9, 2014 at 8:05 am

    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.

    This reply was awarded the best answer by the topic poster.
  • yogev
    yogev
    Newbie 48 points
    August 9, 2014 at 2:24 pm

    tnx ! amazing code ๐Ÿ˜‰

  • yogev
    yogev
    Newbie 48 points
    August 14, 2014 at 1:47 pm

    <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 ?

  • CodersPress.com
    CodersPress.com
    Elite Member 524 points
    August 14, 2014 at 2:06 pm

    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>
  • yogev
    yogev
    Newbie 48 points
    August 14, 2014 at 8:56 pm

    thank you so much! pro comments!!

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