Modify footer php to obtain a link markup

Discussion in 'PHP' started by alessandro, Aug 2, 2018.

Tags:
  1. alessandro

    alessandro New Member

    Joined:
    Aug 1, 2018
    Messages:
    5
    Likes Received:
    2
    Trophy Points:
    3
    Gender:
    Male
    Hello there,

    my first post here hello everybody, i need help regarding a footer.php in wordpress.
    The theme i use do not allow a link mark-up on a text in the footer area i think the snippet is this:

    1. $custom_text_html = '';
    2. $custom_text = boldthemes_get_option( 'custom_text' );
    3. if ( $custom_text != '' ) {
    4. $custom_text_html = '<p class="copyLine">' . $custom_text . '</p>';
    can someon can help me to change it to achieve what i need?

    Ty

    Alex
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    The theme footer code that you have shared doesn't have any code that removes the HTML code from. custom_text can contain HTML as far as the above code is concerned.
     
  3. alessandro

    alessandro New Member

    Joined:
    Aug 1, 2018
    Messages:
    5
    Likes Received:
    2
    Trophy Points:
    3
    Gender:
    Male
    But the <a href> markup doesn't work it still show only text not linkable

    i've found this comment about in a theme develope site:

    The thing with the custom footer text on header & footer panel is that all text within customize panels have to be sanitized prior to output on front end for the reasons of security.

    On the other hand, if you take a look at the lines 23-26 of the footer.php file in your theme’s folder you will notice the following:

    $custom_text = boldthemes_get_option( 'custom_text' );
    if ( $custom_text != '' ) {
    $custom_text_html = '<p class="copyLine">' . $custom_text . '</p>';
    }

    You can change this so the $custom_text_html gets the markup you want.
     
  4. alessandro

    alessandro New Member

    Joined:
    Aug 1, 2018
    Messages:
    5
    Likes Received:
    2
    Trophy Points:
    3
    Gender:
    Male
    I've done, i've changed the p whit a tag

    '<a href="url">' . $custom_text . '</a>';

    instead of

    '<p class="copyLine">' . $custom_text . '</p>'

    it works, thank you anyway
     
    shabbir likes this.
  5. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    That is good as long as it works. Also you can change boldthemes_get_option to get_option official WP function and the HTML won't be removed. Even if it is removed then it has to be via some filter
     
  6. alessandro

    alessandro New Member

    Joined:
    Aug 1, 2018
    Messages:
    5
    Likes Received:
    2
    Trophy Points:
    3
    Gender:
    Male
    ty Shabbir,

    can you tell me what exactly i should write? and where
     
  7. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    Change

    $custom_text = boldthemes_get_option( 'custom_text' );

    to

    $custom_text = get_option( 'custom_text' );
     
  8. alessandro

    alessandro New Member

    Joined:
    Aug 1, 2018
    Messages:
    5
    Likes Received:
    2
    Trophy Points:
    3
    Gender:
    Male
    ty so much Shabbir
     
    shabbir likes this.
  9. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    My pleasure
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice