WordPress.org

Support

Support » Themes and Templates » [Resolved] Make Feature Page titles Hyper Text (clickable)

[Resolved] Make Feature Page titles Hyper Text (clickable)

Viewing 13 replies - 1 through 13 (of 13 total)
  • Try adding this to your child-theme functions.php :

    add_filter('tc_fp_single_display', 'add_title_link', 20, 6);
    function add_title_link($html, $fp_single_id, $show_img, $fp_img, $featured_page_link, $featured_page_title){
        $link = '<a href="'.$featured_page_link.'">'.$featured_page_title.'</a>';
        return str_replace('<h2>'.$featured_page_title.'</h2>', '<h2>'.$link.'</h2>',$html);
    }

    It’s not that beautiful, and maybe there’s a better solution, but should work.

    Whatever that did, it killed my site. I just get a blank screen both on the site and wp-admin. Renamed my functions file to bak and it is working again. Even after I removed the code from the funtions files. (I am using child)
    wow…

    Well I tested the code and pasted it here.
    Now I copied the code from here and pasted in my child theme functions.php.
    It works, and of course no blank page.
    Plus if you get a blank page also if you remove that code.. probably that code is not the problem.
    Do you have debug enabled? https://codex.wordpress.org/WP_DEBUG
    Could be useful to understand what happens, it will display an error instead of a blank page…

    Even after removing that snippet If I activate the functions in child my site is dead, both front and back end. any ideas?

    If you have an error in your functions.php then it’s normal that also the back end dies.
    I suggest you to enable the debug mode. Could really be a silly thing, like a missing semicolon, bracket not closed, ecc. ecc.

    OK, found the problem, thank you for what to look for. When I removed the snippet I also deleted the closing bracket for the prior snippet. Fixed now.

    Is there anything I need to add to that snippet? It doesn’t make the Featured Title text clickable. I can click on the image, but could do that before.

    Nope, it does that, I told you. Is this your site right?
    http://youneedthissite.com/site1/
    I don’t have the extension for unlimited featured pages, probably that makes something, dunno.
    Sorry.

    OK, thanks for the help, was worth a try. And again thanks for the help in fixing my mistake, will not do that again. 🙂

    @questas_admin
    wanna try this other solution with jquery?
    (tested always without that extension but this should be fp-unlimited independent )

    add_action('wp_footer', 'fp_titles_linkizr', 200);
    function fp_titles_linkizr(){
        if ( ! tc__f('__is_home') )
            return;
    ?>
        <script type="text/javascript">
            jQuery(document).ready(function () {
                !function ($){
                    "use strict";
                    $(window).on("load", function(){
                         // grab all a .round-div
                        var $round_divs = $("a").filter(".round-div");
                        // grab all fp-titles
                        var $titles = $(".widget-front > h2");
    
                        $titles.each( function(i) {
                            // let's wrap the title into the round-div link
                            var linkizd_title = '<a href="' + $( $round_divs[i] ).attr('href') + '" title="' + $( $round_divs[i] ).attr('title') + '">' + $(this).text() + '</a>';
                            $(this).html(linkizd_title);
                        });
                    });
                }(window.jQuery);
            });
        </script>
    <?php
    }

    Hope this will work :/

    Fantastic, That worked GREAT… Thank You.

    Finally ! 😀

    Hi,

    I tried the javscript code you provided here: http://themesandco.com/snippet/make-featured-pages-titles-linkable/
    where you say to put it in the Custom CSS section of the customizer option screen of the Theme or the stylesheet of the Child Theme which I have but it did not work. In this thread you say to put it in the child-theme functions.php. Can you tell me which file it goes in?

    Thanks,
    Jasmine

    Sorry that message in the snippet is a standard one I wrongly used for that case. All javascript or php snippets have to be put in the child-theme functions.php

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘[Resolved] Make Feature Page titles Hyper Text (clickable)’ is closed to new replies.