WordPress.org

Ready to get started?Download WordPress

Forums

Customizr
[resolved] Make Feature Page titles Hyper Text (clickable) (12 posts)

  1. questas_admin
    Member
    Posted 3 months ago #

    Is there any way to make the titles on the Featured Pages clickable? I am not using the buttons.
    Thank You

  2. d4z_c0nf
    Member
    Posted 3 months ago #

    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.

  3. questas_admin
    Member
    Posted 3 months ago #

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

  4. d4z_c0nf
    Member
    Posted 3 months ago #

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

  5. questas_admin
    Member
    Posted 3 months ago #

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

  6. d4z_c0nf
    Member
    Posted 3 months ago #

    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.

  7. questas_admin
    Member
    Posted 3 months ago #

    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.

  8. d4z_c0nf
    Member
    Posted 3 months ago #

    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.

  9. questas_admin
    Member
    Posted 3 months ago #

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

  10. d4z_c0nf
    Member
    Posted 3 months ago #

    @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 :/

  11. questas_admin
    Member
    Posted 3 months ago #

    Fantastic, That worked GREAT... Thank You.

  12. d4z_c0nf
    Member
    Posted 3 months ago #

    Finally ! :D

Reply

You must log in to post.

About this Theme

About this Topic