• Resolved paulevisser

    (@paulevisser)


    Hello.

    I am looking to now add a facebook link into the footer.
    For example, click here to like us on Facebook.

    What would be the best way of accomplishing this?

    Thanks
    Paul

Viewing 11 replies - 1 through 11 (of 11 total)
  • Thread Starter paulevisser

    (@paulevisser)

    This is the code fb gave me.

    <iframe src="//www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.facebook.com%2Fallserveniagara&width&layout=standard&action=like&show_faces=false&share=true&height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:35px;" allowTransparency="true"></iframe>

    I just have no idea where to put it.

    Hi there 🙂

    First go to the wordpress dash board.

    And go to the widget area and put the ‘text widget’ on the footer widget area.

    If you make it done, insert the code and then ckeck it on your operated web site.

    Thanks.

    Thread Starter paulevisser

    (@paulevisser)

    That seems to work, but its not centered.

    Do you know the iframe code that I need to make it centered?

    Thanks
    Paul

    Thread Starter paulevisser

    (@paulevisser)

    I tried this in the iframe code, but it’s not working

    <iframe src="//www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.facebook.com%2Fallserveniagara&width&layout=button&action=like&show_faces=false&share=true&height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:35px;" allowTransparency="true";align="center"></iframe>

    Theme Author nobita

    (@nobita)

    functions.php

    <?php
    // facebook code start
    add_filter( 'raindrops_footer_text', 'function_name' );
    
    function function_name( $return_value ) {
    
    	$html_before = '<p style="text-align:center">hello world</p>';
    	$html_after	 = '<iframe src="//www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.facebook.com%2Fallserveniagara&width&layout=button&action=like&show_faces=false&share=true&height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:35px;" allowTransparency="true";align="center"></iframe>';
    
    	return $html_before . $return_value . $html_after;
    }
    // facebook code end
    ?><?php
    /**
     * functions and constants for Raindrops theme
     *
     *
     * @package Raindrops
     * @since Raindrops 0.1
     */
    if ( !defined( 'ABSPATH' ) ) {
    
    	exit;
    }

    result below

    http://www.tenman.info/wp3/manualraindrops/files/footer-example.gif

    Thread Starter paulevisser

    (@paulevisser)

    It works until I add the content from the existing function.php file

    Old file was:

    <?php
    add_filter( 'raindrops_footer_text', 'function_name' );
    function function_name( $return_value ) {
            $return_value = '';
    	$html_before = '<p style="text-align:center;color:red;">©2014 ALL-Serve Niagara</p>';
    
    	return $html_before . $return_value ;
    }

    So I merged the two and made this:

    <?php
    // facebook code start
    add_filter( 'raindrops_footer_text', 'function_name' );
    
    function function_name( $return_value ) {
    
    	$html_before = '<p style="text-align:center">hello world</p>';
    	$html_after	 = '<iframe src="//www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.facebook.com%2Fallserveniagara&width&layout=button&action=like&show_faces=false&share=true&height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:35px;" allowTransparency="true";align="center"></iframe>';
    
    	return $html_before . $return_value . $html_after;
    }
    // facebook code end
    ?><?php
    /**
     * functions and constants for Raindrops theme
     *
     *
     * @package Raindrops
     * @since Raindrops 0.1
     */
    if ( !defined( 'ABSPATH' ) ) {
    
    	exit;
    }
    add_filter( 'raindrops_footer_text', 'function_name' );
    function function_name( $return_value ) {
            $return_value = '';
    	$html_before = '<p style="text-align:center;color:red;">©2014 ALL-Serve Niagara</p>';
    
    	return $html_before . $return_value ;
    }

    But then I get an error:

    Fatal error: Cannot redeclare function_name() (previously declared in /home/content/p3pnexwpnas04_data02/42/2342542/html/wp-content/themes/raindrops-child/functions.php:5) in /home/content/p3pnexwpnas04_data02/42/2342542/html/wp-content/themes/raindrops-child/functions.php on line 31

    Each code on its own works fine, put them together, and somewhere I am messing it up.

    Thanks for all you assistance so far.
    Paul

    Theme Author nobita

    (@nobita)

    if ( !defined( 'ABSPATH' ) ) {
    
    	exit;
    }
    //remove start
    add_filter( 'raindrops_footer_text', 'function_name' );
    function function_name( $return_value ) {
            $return_value = '';
    	$html_before = '<p style="text-align:center;color:red;">©2014 ALL-Serve Niagara</p>';
    
    	return $html_before . $return_value ;
    }
    //remove end

    You should learn the basics of PHP

    Thread Starter paulevisser

    (@paulevisser)

    I am very slowly,
    Thanks for your patience

    Paul

    Thread Starter paulevisser

    (@paulevisser)

    SO, I merged the code into the functions.php
    Receive an error:

    Fatal error: Cannot redeclare function_name() (previously declared in /home/content/p3pnexwpnas04_data02/42/2342542/html/wp-content/themes/raindrops-child/functions.php:5) in /home/content/p3pnexwpnas04_data02/42/2342542/html/wp-content/themes/raindrops-child/functions.php on line 33

    Can I just add a “1” to the end of the function name?

    Heres my new functions.php:

    <?php
    // facebook code start
    add_filter( 'raindrops_footer_text', 'function_name' );
    
    function function_name( $return_value ) {
    
    	$html_before = '<p style="text-align:center">hello world</p>';
    	$html_after	 = '<iframe src="//www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.facebook.com%2Fallserveniagara&width&layout=button&action=like&show_faces=false&share=true&height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:35px;" allowTransparency="true";align="center"></iframe>';
    
    	return $html_before . $return_value . $html_after;
    }
    // facebook code end
    ?><?php
    /**
     * functions and constants for Raindrops theme
     *
     *
     * @package Raindrops
     * @since Raindrops 0.1
     */
    if ( !defined( 'ABSPATH' ) ) {
    
    	exit;
    }
    
    //remove start
    add_filter( 'raindrops_footer_text', 'function_name' );
    function function_name( $return_value ) {
            $return_value = '';
    	$html_before = '<p style="text-align:center;color:red;">©2014 ALL-Serve Niagara</p>';
    
    	return $html_before . $return_value ;
    }
    //remove end

    Many thanks
    Paul

    Thread Starter paulevisser

    (@paulevisser)

    Ok ,nobita.

    Did some studying.
    I was able to trim the code to this:

    <?php
    add_filter( 'raindrops_footer_text', 'function_name' );
    
    function function_name( $return_value ) {
            $return_value = '';
    	$html_before = '<p style="text-align:center;color:red;">©2014 ALL-Serve Niagara</p>';
    	$html_after	 = '<iframe src="//www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.facebook.com%2Fallserveniagara&width&layout=button&action=like&show_faces=false&share=true&height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:35px;" allowTransparency="true";align="center"></iframe>';
    
    	return $html_before . $return_value . $html_after;
    }
    ?>

    And it all seems fine, however, if you look at the footer:
    allserveniagara.ca

    You will see the FB iframe is not centered?

    Any ideas how to adjust that?

    Paul

    Thread Starter paulevisser

    (@paulevisser)

    Never mind, it a FB developer site setting.

    Thanks for all your help

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘FaceBook in Footer’ is closed to new replies.