• Resolved wph4

    (@wph4)


    Hi There,

    I have used this same code before in another site and it is working perfectly.

    But for this new site… whenever I active something into these 3 extra home feature pages it comes back for every page.

    It needs to be a comma or something like that…. I think…

    What do I need to do?

    <?php
    /* Write your awesome functions below */
    
    // =========start 1 Adds 3 widget areas below Featured page section on Home page 
    
    add_filter( 'tc_default_widgets' , 'add_featured_page_widget' );
    function add_featured_page_widget( $default_widgets_area ) {
    
    $default_widgets_area ['fp_widgets'] = array(
    'name' => __( 'Featured Pages Widget One' , 'customizr' ),
    'description' => __( 'Below the featured pages area on home' , 'customizr' )
    );
    
    $default_widgets_area['fp_widgets_two'] = array(
    'name' => __( 'Featured Pages Widget Two' , 'customizr' ),
    'description' => __( 'Below the featured pages area on home' , 'customizr' )
    );
    
    $default_widgets_area['fp_widgets_three'] = array(
    'name' => __( 'Featured Pages Widget Three' , 'customizr' ),
    'description' => __( 'Below the featured pages area on home' , 'customizr' )
    );
    
    return $default_widgets_area;
    }
    
    //add_action('__after_fp' , 'display_my_fp_widget');
    add_action('__before_footer' , 'display_my_fp_widget');
    function display_my_fp_widget() {
      ?>
      <div class="row-fluid">
        <div class="span4"><?php dynamic_sidebar('fp_widgets'); ?></div>
        <div class="span4"><?php dynamic_sidebar('fp_widgets_two'); ?></div>
        <div class="span4"><?php dynamic_sidebar('fp_widgets_three'); ?></div>
      </div>
      <?php
    }
    
    // Style all the featured pages widgets so they take up the right space
    add_filter( 'fp_widgets_class', 'display_my_fp_widget_class');
    add_filter( 'fp_widgets_two_widget_class', 'display_my_fp_widget_class');
    add_filter( 'fp_widgets_three_widget_class', 'display_my_fp_widget_class');
    function add_featured_page_widget_class() {
    return 'span4';
    }
    
    /* =========start 2 not html allowed by comments   */
    add_filter('comment_form_defaults' , 'remove_allowed_html_tags_note', 30);
    function remove_allowed_html_tags_note( $defaults ) {
    	//returns the modified array
    	return array_replace( $defaults, array('comment_notes_after' => '' ) );
    }
    /* =========start 3 - space by credits line - colophon line space to 2 + 8 + 2 */
    //=================colophon line space to 2 + 8 + 2
    add_filter( 'tc_colophon_left_block_class', 'my_colophon_left_block_class' );
    function my_colophon_left_block_class() {
        return 'span2 social-block pull-left';
    }
    add_filter( 'tc_colophon_center_block_class', 'my_colophon_center_block_class' );
    function my_colophon_center_block_class() {
        return 'span8 credits';
    }
    add_filter( 'tc_colophon_right_block_class', 'my_colophon_right_block_class' );
    function my_colophon_right_block_class() {
        return 'span2 backtop';
    }
    /* =========start 4  footer credits*/
    add_filter('tc_credits_display', 'my_custom_credits');
    function my_custom_credits(){
    $credits = 'Alle rechten voorbehouden. By <a href="http://www.H4-Business-Support.com/" target="_blank">H4 Business Support</a>';
    $newline_credits = '';
    return '
    <div class="span8 credits">
                        <p> · © '.esc_attr( date( 'Y' ) ).' <a href="'.esc_url( home_url() ).'" title="'.esc_attr(get_bloginfo()).'" rel="bookmark">'.esc_attr(get_bloginfo()).'</a> · '.($credits ? $credits : 'Designed by <a href="http://www.themesandco.com/">Themes & Co</a>').' ·'.($newline_credits ? '<br />· '.$newline_credits.' ·' : '').'</p>        </div>';
    }

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi wph4:

    add_action('__before_footer' , 'display_my_fp_widget');
    function display_my_fp_widget() {
      ?>
      <div class="row-fluid">
        <div class="span4"><?php dynamic_sidebar('fp_widgets'); ?></div>
        <div class="span4"><?php dynamic_sidebar('fp_widgets_two'); ?></div>
        <div class="span4"><?php dynamic_sidebar('fp_widgets_three'); ?></div>
      </div>
      <?php
    }

    add this :

    if ( ! tc__f('__is_home') )
      return;

    just after the function definition so:

    function display_my_fp_widget() {
      if ( ! tc__f('__is_home') )
        return;
      ?>

    should do the trick, let me know 😉

    p.s.
    the original snippet used: //add_action('__after_fp' , 'display_my_fp_widget');
    right? that’s because that hook __after_fp is available just where the fp are enabled, so in home 😉

    Hope this helps and explains the “problem”

    Thread Starter wph4

    (@wph4)

    I will read and apply. Then I will let you know.

    I do need to learn more….. 😉

    We all need that! 😀

    Thread Starter wph4

    (@wph4)

    It works.
    I remember now why I have changed it.
    I have some pictures after the featured pages and wanted the widgets just underneath those pictures….

    Molte grazie!

    Now to the next change 😉

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘extra Feature page widget appears everywhere….’ is closed to new replies.