- This topic has 5 replies, 2 voices, and was last updated 8 years, 9 months ago by Tatsujin.
-
AuthorPosts
-
February 23, 2016 at 3:07 pm #86089TatsujinParticipant
Thank you for your support in the previous ticket.
We have added the extra widget area within our home page, but now need it to appear further down the page, below the body content.
In the functions.php file, what do we need to alter to move it down below the body content?
Thanks in advance.
February 23, 2016 at 5:27 pm #86111MaheshParticipantHi @tatsujin,
Can you please share your code with which you are displaying the widget. We need to check where you’ve hooked the widget to. First it needs to be remove from previous hook then hooked to the desired position. And by below body content, do you mean to place it below the main content (primary, secondary) and just above the footer.
Regards,
MaheshFebruary 23, 2016 at 5:57 pm #86116TatsujinParticipantOn the home page, it’s currently appearing above/before this code:
<section class=”post-1512 post type-post status-publish format-standard hentry category-home”>
<article class=”full-width”> content goes here </article>
<!– .post-article –>
</section>We need it to appear directly after/below this code.
In the functions.php file we have this currently:
<?php
/**
* Child Theme functions and definitions
*
*//**
* Loading Parent theme stylesheet
*
*/
add_action( ‘wp_enqueue_scripts’, ‘simplecatch_child_enqueue_styles’ );
function simplecatch_child_enqueue_styles() {
wp_enqueue_style( ‘simplecatch-parent-style’, get_template_directory_uri() . ‘/style.css’ );
}function simplecatch_child_widgets_init() {
/* Register Widgets */
//Below Header
register_sidebar( array(
‘name’ => __( ‘Below Header’, ‘simple-catch’ ),
‘id’ => ‘below-header’,
‘description’ => __( ‘This is Below Header widget area’, ‘simple-catch’ ),
‘before_widget’ => ‘<aside id=”%1$s” class=”widget %2$s”>’,
‘after_widget’ => ‘</aside>’,
‘before_title’ => ‘<h3 class=”widget-title”>’,
‘after_title’ => ‘</h3><hr/>’
) );
//After Main Content
register_sidebar( array(
‘name’ => __( ‘After Main Content’, ‘simple-catch’ ),
‘id’ => ‘after-content’,
‘description’ => __( ‘This is After Main Content widget area’, ‘simple-catch’ ),
‘before_widget’ => ‘<aside id=”%1$s” class=”widget %2$s”>’,
‘after_widget’ => ‘</aside>’,
‘before_title’ => ‘<h3 class=”widget-title”>’,
‘after_title’ => ‘</h3>’
) );//Widget for slider in homepage
register_sidebar( array(
‘name’ => __( ‘Homepage Slider’, ‘simple-catch’ ),
‘id’ => ‘homepage-slider’,
‘description’ => __( ‘This is Homepage Slider Content widget area’, ‘simple-catch’ ),
‘before_widget’ => ‘<aside id=”%1$s” class=”widget %2$s”>’,
‘after_widget’ => ‘</aside>’,
‘before_title’ => ‘<h3 class=”widget-title”>’,
‘after_title’ => ‘</h3>’
) );
}
add_action( ‘widgets_init’, ‘simplecatch_child_widgets_init’ );function simplecatch_child_below_header_widget(){
simplecatch_menu(); //Remove this function if you do not want the primary menu
if ( is_active_sidebar( ‘below-header’ ) ) {
dynamic_sidebar( ‘below-header’ );
}
}
add_action( ‘simplecatch_after_headercontent’, ‘simplecatch_child_below_header_widget’, 16 );add_action( ‘init’ , ‘simplecatch_child_remove_primary_menu’);
function simplecatch_child_remove_primary_menu() {
remove_action( ‘simplecatch_after_headercontent’, ‘simplecatch_menu’, 15 );
}function simplecatch_child_after_content_widget(){
if ( is_active_sidebar( ‘after-content’ ) ) {
dynamic_sidebar( ‘after-content’ );
}
}
add_action( ‘simplecatch_child_after_content’, ‘simplecatch_child_after_content_widget’, 10 );function simplecatch_child_homepage_slider_widget(){
if ( is_active_sidebar( ‘homepage-slider’ ) ) {
dynamic_sidebar( ‘homepage-slider’ );
}
}
add_action( ‘simplecatch_child_before_content’, ‘simplecatch_child_homepage_slider_widget’, 10 );function simplecatch_content() {
global $post;if ( is_attachment() ) {
$parent = $post->post_parent;
$layout = get_post_meta( $parent,’simplecatch-sidebarlayout’, true );
} else {
$layout = get_post_meta( $post->ID,’simplecatch-sidebarlayout’, true );
}if( empty( $layout ) )
$layout=’default’;get_header();
global $simplecatch_options_settings;
$options = $simplecatch_options_settings;
$themeoption_layout = $options[‘sidebar_layout’];while ( have_posts() ):the_post();
if ( function_exists( ‘simplecatch_loop’) ) simplecatch_loop();
comments_template();
endwhile; ?>
<?php do_action( ‘simplecatch_child_after_content’ ); ?>
</div><!– #primary –><?php
/**
* simplecatch_below_primary hook
*/
do_action( ‘simplecatch_below_primary’ );
?><?php
if ( $layout == ‘left-sidebar’ || $layout == ‘right-sidebar’ || ( $layout==’default’ && $themeoption_layout == ‘left-sidebar’ ) || ( $layout==’default’ && $themeoption_layout == ‘right-sidebar’ ) ) {
get_sidebar();
}get_footer();
}
February 24, 2016 at 9:39 am #86158MaheshParticipantHi @tatsujin,
I assume that you want the slider below main content and just above the footer. For that add the following code in your child theme’s
functions.php
:function simplecatch_child_slider_below_content() { remove_action( 'simplecatch_after_headercontent', 'simplecatch_slider_display', 20 ); add_action( 'simplecatch_after_main_slider', 'simplecatch_slider_display', 10 ); } add_action('init', 'simplecatch_child_slider_below_content');
Then create
footer.php
file in your child theme’s folder and paste in the following codes.<?php /** * The template for displaying the footer. * * @package Catch Themes * @subpackage Simple_Catch_Pro * @since Simple Catch Pro 1.0 */ ?> </div> <!-- #main --> <div class="wrapper"> <?php /** * simplecatch_after_main_slider hook */ do_action( 'simplecatch_after_main_slider' ); ?> </div> <?php /** * catchthemes_after_main hook */ do_action( 'simplecatch_after_main' ); ?> <footer id="colophon"> <?php /** * simplecatch_footer hook * * @hooked simplecatch_footercontent - 15 */ do_action( 'simplecatch_footer' ); ?> </footer><!-- #colophon --> <?php /** * simplecatch_after hook * * @hooked simplecatch_scrollup - 15 */ do_action( 'simplecatch_after' ); ?> <?php wp_footer(); ?> </body> </html>
Let me know if any problem.
Regards,
MaheshFebruary 24, 2016 at 10:42 am #86168MaheshParticipantHi @tatsujin,
I thought you meant home slider. 🙂 Forget all of the code above that I’ve given.
For the custom widget created earlier, you have to modify some codes in child themes. In your child theme’s functions.php, find the following line:
add_action( 'simplecatch_child_before_content', 'simplecatch_child_homepage_slider_widget', 10 );
then change it to the following:
add_action( 'simplecatch_child_after_content', 'simplecatch_child_homepage_slider_widget', 10 );
I assume, you have overridden the index.php and have this line just above the primary div’s closing.
<?php do_action( 'simplecatch_child_after_content' ); ?>
Regards,
MaheshFebruary 24, 2016 at 10:58 am #86174TatsujinParticipantPerfect, that got it!
Thanks for all your help! 🙂
-
AuthorPosts
- The topic ‘Move widget position’ is closed to new replies.