WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Insert slideshow on homepage on top of posts

[Resolved] Insert slideshow on homepage on top of posts

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Stefan Boonstra

    @stefanboonstra

    Hi,

    Inserting the code snippet in your theme’s ‘content.php’ is alright. You can use WordPress’ ‘is_home()‘ function to test wether or not you’re on the homepage of your website.

    if(is_home())
        do_action('slideshow_deploy', 'the ID of your slideshow');

    Best regards,
    Stefan

    Hi,

    I did insert the code on content.php but the slideshow appears on top of every post…. bad !

    I just want it to show on top of the first post (with some space before the first post)

    Like this

    slideshow
    space
    post
    post
    post
    post

    Any idea?

    Plugin Author Stefan Boonstra

    @stefanboonstra

    I’m sorry, I misunderstood that.

    You should insert the slideshow’s PHP snippet outside of the WordPress loop, which means placing it in your theme’s ‘index.php’ file.

    A good place to add the PHP snippet is probably after the line with ‘<div id="content" role="main">‘ in your theme’s ‘index.php’ file. Depending on wether or not you’d like to show it just on the home page, you can keep or remove the ‘is_home()‘ check on the slideshow’s PHP snippet.

    It’s possible to adapt the slideshow’s stylesheet on the ‘General Settings’ page, then selecting the customized stylesheet as style setting on the slideshow’s settings page. You can of course also add this space in the ‘index.php’ file itself.

    <?php
    /**
     * The main template file.
     *
     * This is the most generic template file in a WordPress theme
     * and one of the two required files for a theme (the other being style.css).
     * It is used to display a page when nothing more specific matches a query.
     * E.g., it puts together the home page when no home.php file exists.
     * Learn more: http://codex.wordpress.org/Template_Hierarchy
     *
     * @package Catch Themes
     * @subpackage Catch_Box
     */
    
    get_header(); ?>            	
    
    			<?php if ( have_posts() ) : ?>
    
    				<?php /* Start the Loop */ ?>
    				<?php while ( have_posts() ) : the_post(); ?>
    
    					<?php get_template_part( 'content', get_post_format() ); ?>
    
    				<?php endwhile; ?>
    
    				<?php catchbox_content_nav( 'nav-below' ); ?>
    
    			<?php else : ?>
    
    				<article id="post-0" class="post no-results not-found">
    					<header class="entry-header">
    						<h1 class="entry-title"><?php _e( 'Nothing Found', 'catchbox' ); ?></h1>
    					</header><!-- .entry-header -->
    
    					<div class="entry-content">
    						<p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'catchbox' ); ?></p>
    						<?php get_search_form(); ?>
    					</div><!-- .entry-content -->
    				</article><!-- #post-0 -->
    
    			<?php endif; ?>
    
    			</div><!-- #content -->
    		</div><!-- #primary -->
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    Here is my index.php code, ive tried to pud the code almost everywhere but nothing worked, at best the slideshow appeared at the bottom of the page after content…

    Plugin Author Stefan Boonstra

    @stefanboonstra

    Alright, perhaps the ‘<div id="content" role="main">‘ is in the header file of your theme. Have you already tried placing the code below the ‘get_header();‘ function? It would look something like this:

    get_header();
    
    if(is_home())
        do_action('slideshow_deploy', 'the ID of your slideshow'); ?>

    Mind that you can only use the code within the ‘<?php‘ and ‘?>‘ PHP opening and closing tags.

    GOOOOOOOOOD !!!!

    Thx a lot Stefan…

    Just one last thing… as i am not expert in code, would be kind and tell me how to insert some space between the slideshow and the first post ?

    (same space as between the posts) !

    That would be great !

    Thanks a lot

    Plugin Author Stefan Boonstra

    @stefanboonstra

    With a space added in HTML it would look like this:

    get_header();
    
    if(is_home())
        do_action('slideshow_deploy', 'the ID of your slideshow'); ?>
    
    <div style="width: 100%; height: 20px;"></div>

    That will create a space of 20 pixels heigh, you can put any number of pixels you want here.

    The other way is setting a margin (spacing) at the bottom of the slideshow by going to the ‘Custom Styles’ tab on the ‘General Settings’ page, then click ‘Customize’ on (probably) the ‘Light’ default stylesheet. Add ‘margin-bottom: 20px;’ to the ‘slideshow_container { }’ class (between the brackets: ‘{ }’). After that you’ll have to select the customized stylesheet in your slideshow.

    This is it !!!!

    Thx a lot Stefan, never seen such a goood support for a plugin 🙂

    Thx again !

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Resolved] Insert slideshow on homepage on top of posts’ is closed to new replies.