WordPress.org

Forums

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

  1. questas_admin
    Member
    Posted 1 year 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 1 year 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 1 year 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 1 year 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 1 year 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 1 year 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 1 year 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 1 year 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 1 year 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 1 year 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 1 year ago #

    Fantastic, That worked GREAT... Thank You.

  12. d4z_c0nf
    Member
    Posted 1 year ago #

    Finally ! :D

  13. snowmom76
    Member
    Posted 1 month ago #

    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

  14. d4z_c0nf
    Member
    Posted 1 month ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic