• Gday,
    So im attempting to change the logo link, by using the snippet provided, I have set both my links to what I need them to be, and have placed the snippet inside functions.php in the section it needs to be in.

    for some reason though I am still getting it referencing back to the initial webpage.

    Heres the snippet directly copied from the functions.php file.

    add_filter('tc_logo_title_display', 'change_site_main_link');
    function change_site_main_link($output) {
        return preg_replace('|href=https://xyz.net/|', 'href=https://yzx.com.au/', $output);'<blockquote>
    }

    Thanks for any help available.

    Jake

Viewing 7 replies - 1 through 7 (of 7 total)
  • Did you do this in the functions.php of a Child Theme?

    Not recommended to hack a core file, and the Snippets are all written with Child Theme in mind.

    Thread Starter jazzatomo

    (@jazzatomo)

    Yes, I am placing it at the bottom of my current child theme

    Origionally it was in a core, but I decided to finally make the switch.

    Either way, it appears that the result is the same.

    But otherwise, your functions.php is empty, correct? See here for more info on how it works: https://www.themesandco.com/customizr/how-to-customize-customizr-wordpress-theme/

    Thread Starter jazzatomo

    (@jazzatomo)

    not anymore, I am running a custom FB button, some slider mods and a couple of other things I haven’t labelled properly at this stage.

    That’s my whole functions.php, although as I keep modifying the site it grows and shrinks.

    <?php
    add_filter('tc_logo_title_display', 'change_site_main_link');
    function change_site_main_link($output) {
        return preg_replace('|href="https://1742455934529.netau.net/|', 'href="https://www.wiltronics.com.au/', $output);
    }
    
    // set the whole slider as a single animated button. Removes call to action
    add_action('wp_head' , 'link_whole_slide');
    function link_whole_slide() {
       //sets the slider image link
       add_filter('tc_slide_background' , 'my_slide_link', 10, 2);
        function my_slide_link( $slide_image , $slide_link) {
            //sets the slider image link
            return sprintf('<a href="%1$s">%2$s</a>',
                $slide_link,
                $slide_image
            );
        }
        //wraps the slider caption in the same link as the call to action button
        ?>
        <script type="text/javascript">
            jQuery(document).ready(function () {
                ! function ($) {
                    //prevents js conflicts
                    "use strict";
    
                    $( '.carousel-caption' ).each(function( index ) {
                      var link = $( this ).find('a').attr('href');
                      $(this).wrap('<a href="'+link+'"></a>');
                    });
                }(window.jQuery)
            });
        </script>
        <?php
    }
    
    // Stop slider pausing on mouse hover
    add_filter( 'tc_stop_slider_hover','my_slider_hover_value');
    function my_slider_hover_value() {
        return false;
    }
    
    //we hook the code on the wp_head hook, this way it will be executed before any html rendering.
    add_action ( 'wp_head' , 'move_my_slider');
    function move_my_slider() {
        //we unhook the slider
        remove_action( '__after_header' , array( TC_slider::$instance , 'tc_slider_display' ));
    
        //we re-hook the slider. Check the priority here : set to 0 to be the first in the list of different actions hooked to this hook
        add_action( '__before_footer' , array( TC_slider::$instance , 'tc_slider_display' ), 0);
    }

    OK, now checked this. It looks like the code was different when @acub wrote that. This should now work instead:

    add_filter('tc_logo_link_url', 'change_site_main_link');
    function change_site_main_link($output) {
        return 'https://YOURLINK';
    }

    Thread Starter jazzatomo

    (@jazzatomo)

    Thanks that worked perfectly.

    Thank you EF. Updated the snippet to work with last version of Customizr.
    @jazzatomo: your initial code couldn’t have worked. It’s not valid php. After the ending of the command you wrongly pasted

    '<blockquote>

    which shouldn’t have been there. However, as EF pointed out, the snippet used a filter that’s no longer valid in current Customirz version.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Changing Logo Link Error (Snippet not working)’ is closed to new replies.