• Resolved moonbeam1102

    (@moonbeam1102)


    I’m trying to make my tagline a clickable link. Here’s a link to my site: http://www.iaba-louisville.org/update/

    In the Customize it section for the tagline, I entered the following code:
    <a href="http://www.iaba-louisville.org/update/?page_id=129">Join Now</a>

    Initially, the code displayed on the site instead of the clickable link. I found another thread where a user suggested editing parts/class-header-menu.php by replacing a certain piece of code with: <h2 class="span7 inside site-description"><?php echo wp_specialchars_decode(esc_attr(get_bloginfo( 'description' ))); ?></h2>

    This made my link display correctly, but it’s not linking correctly. I think it’s still subbing out my > and “

    Any solution?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Where is the link suppose to go?

    Thread Starter moonbeam1102

    (@moonbeam1102)

    Have you checked your media library? At the bottom of that area it all this information about the slider and then it says “choose a link page and post”. I’m guessing that just needs to be adjusted?

    First off, I do not recommend putting a link inside the tagline, SEO wise. Tagline is displayed by search engines and it will always be treated as a descriptive slogan/quote and will be stripped of any html. In other words, if you put a link inside it, you should expect it to be stripped when displayed in search engines results, sometimes even with the text that’s supposed to be the link.

    I also do not recommend modifying parts/class-header-menu.php because that file is prone to changes at updates from any of it’s parts:
    – menu social links
    – menu display
    – logo display
    – tagline display

    If the theme author changes any of those for any display (mobile, tablet, desktop), than class-header-menu.php changes in parent theme. And if you have it in your child theme, yours will be loaded so you are practically giving up the future updates on any of the elements listed above. In addition, if the file in the parent file changes to the point that the theme expects a different output from it, your installation will break.

    A much safer approach is to only filter the display of the tagline: tc_tagline_display, by adding in your child theme’s functions.php:

    add_filter('tc_tagline_display', 'your_tagline_filter_function');
    function your_tagline_filter_function($html) {
    // do stuff to $html (it holds the html containing your tagline)
    return $html;
    }

    Of course, you need to modify $html contents. You could run a preg_replace() and modify its contents. Or you could just return

    return '<a href="your_custom_link" title="your_custom_title">'.$html.'</a>';

    which wraps all description (including the h2 tag) in your link. This is good, as search engines will continue to take the h2 contents and display it properly. Just make sure it makes some sense even without the link: (ex: Join us now!).

    Here’s how I would do this: I’d put a proper slogan inside the tagline. Like “homes for tomorrow” or whatever you or your client think is best. Add this to functions.php (version of the function above):

    add_filter('tc_tagline_display', 'your_tagline_filter_function');
    function your_tagline_filter_function($html) {
    return $html.'<h2 class="tagline-teaser"><a href="your_linl" title="your_description">Join Now</a></h2>';
    }

    And add this in your style.css of your child theme or in the custom CSS panel:

    h2.site-description {diplay: none;}
    h2.tagline-teaser, h2.tagline-teaser a {  font-size: 18px;
      padding-top: 0px;
      line-height: 20px;
      font-style: italic;
      color: #9db668;
    }

    The slogan will never appear on the page, but it will be displayed by search engines under your site title. Instead of it, your website will display the link.

    Hi acub, I tested the code as you said:
    Add to functions.php

    [ Moderator note: please wrap code in backticks or use the code button. Do not use blockquote. ]

    add_filter('tc_tagline_display', 'your_tagline_filter_function');
    function your_tagline_filter_function($html) {
    return $html.'<h2 class="tagline-teaser"><a href="your_linl" title="your_description">Test</a></h2>';
    }

    And add style.css:

    h2.site-description {diplay: none;}
    
    h2.tagline-teaser, h2.tagline-teaser a {  font-size: 18px;
      padding-top: 0px;
      line-height: 20px;
      font-style: italic;
      color: #9db668;
    }

    But not works fine for me:
    http://www.greenfuelsbio.com/test_link.jpg
    2 links appear, are underlined in red.
    So, i want to put the flags of the qtranslate widget (or some custom links) to the right of the social icons.
    Can you help me plz ?
    Thanks.

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    GreenFuelsBio?Per the forum welcome can you please post your own topic?

    http://wordpress.org/support/theme/customizr#postform

    This one is not yours and is marked resolved already.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Make Tagline a link’ is closed to new replies.