Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Home page content

    Hi,

    There is something wrong with the home page. I can only write Posts on the home page. With my theme there is a section for the home page which has a slideshow of the posts and then below there is a section for writing home page custom content. When I write something and save it, it doesn't show up on the webpage. If anyone has any ideas, that would be great.

    http://www.pokerpouch.com

    Here is the home.php
    Code:
    <?php 
    global $shortname;
    
    $number_posts = (get_option('posts_per_page')) ? get_option('posts_per_page') : 6;
    
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    
    if (is_active_widget('widget_myFeature')) {
    	$category = "showposts=$posts&cat=-".$options['category'];		
    } else {
    	$category = "showposts=".$posts;		
    } 
    query_posts($category."&paged=$paged&showposts=$number_posts");
    
    get_header();
    
    	//Featured Content Gallery section on the homepage
    	if (is_home() && !isset($_GET['paged'])) :?>
    		<?php if(function_exists('gallery_styles')) :?>
                <div id="fcg-slides">
                	<?php include (ABSPATH . '/wp-content/plugins/featured-content-gallery/gallery.php'); ?>
                </div>
            <?php elseif(isset($_GET['preview']) && isset($_GET['template'])):?>
                <div id="fcg-slides">
                	<img src="<?php bloginfo('template_url')?>/images/fcg-feature-demo.jpg" alt="Plugin Demo" />
                </div>    
            <?php endif;?>
    	<?php endif; ?>
    	
    	<?php if (have_posts()) : ?>
    		<?php
            $i = 0;
            while (have_posts()) {
                the_post(); 
                include(dirname(__FILE__).'/post.php');
                
    			//Insert custom content between posts
    			if ($html = get_option($shortname.'_custom_html_'.$i)) {
                    echo "<div class='customhtml'>$html</div>";
                }
            $i++;
            }
    		?>
    	<?php endif; ?>
        
        <div class="navigation">
            <p class="alignleft"><?php previous_posts_link('Latest posts'); ?></p>
            <p class="alignright"><?php next_posts_link('Older posts'); ?></p>
        </div>
    
    <?php get_footer(); ?>

  • #2
    Regular Coder
    Join Date
    Feb 2008
    Location
    Edinburgh - Scotland
    Posts
    107
    Thanks
    0
    Thanked 12 Times in 12 Posts
    Is this possibly just a setting you can change in the WordPress admin panel?!

    If allow custom content is enabled (if there is a setting)

    perhaps it while loop is not being executed i.e getPosts() is returning 0?

  • #3
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Hi,

    thanks for the response, the only way that I can write something on the home page custom content is if I have a post first. I don't want to have any posts on the home page. Its kind of a weird set-up... Is there any way that I can change this?
    Thanks for your help

    Mark

  • #4
    Regular Coder
    Join Date
    Feb 2008
    Location
    Edinburgh - Scotland
    Posts
    107
    Thanks
    0
    Thanked 12 Times in 12 Posts
    Yeah there is!!!

    the bit of code you care about is this bit:

    Code:
    <?php if (have_posts()) : ?>
    		<?php
            $i = 0;
            while (have_posts()) {
                the_post(); 
                include(dirname(__FILE__).'/post.php');
                
    			//Insert custom content between posts
    			if ($html = get_option($shortname.'_custom_html_'.$i)) {
                    echo "<div class='customhtml'>$html</div>";
                }
            $i++;
            }
    		?>
    	<?php endif; ?>
    So what that is saying is - :

    If we have posts

    --for each post that we do have insert some custom content + continue as we were!
    If you wanted a bit of custom code on EVERY home page regardless of the number of posts you have you could just add this bit of code above the coded section I pasted above :

    Code:
    <?php echo "<h2>Demo custom content</h2>" ?>
    so your total code would look
    something like this:

    Code:
    <?php 
    global $shortname;
    
    $number_posts = (get_option('posts_per_page')) ? get_option('posts_per_page') : 6;
    
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    
    if (is_active_widget('widget_myFeature')) {
    	$category = "showposts=$posts&cat=-".$options['category'];		
    } else {
    	$category = "showposts=".$posts;		
    } 
    query_posts($category."&paged=$paged&showposts=$number_posts");
    
    get_header();
    
    	//Featured Content Gallery section on the homepage
    	if (is_home() && !isset($_GET['paged'])) :?>
             <?php echo "<h2>Demo custom content</h2>"; ?>
    		<?php if(function_exists('gallery_styles')) :?>
                <div id="fcg-slides">
                	<?php include (ABSPATH . '/wp-content/plugins/featured-content-gallery/gallery.php'); ?>
                </div>
            <?php elseif(isset($_GET['preview']) && isset($_GET['template'])):?>
                <div id="fcg-slides">
                	<img src="<?php bloginfo('template_url')?>/images/fcg-feature-demo.jpg" alt="Plugin Demo" />
                </div>    
            <?php endif;?>
    	<?php endif; ?>
    	
    	<?php if (have_posts()) : ?>
    		<?php
            $i = 0;
            while (have_posts()) {
                the_post(); 
                include(dirname(__FILE__).'/post.php');
                
    			//Insert custom content between posts
    			if ($html = get_option($shortname.'_custom_html_'.$i)) {
                    echo "<div class='customhtml'>$html</div>";
                }
            $i++;
            }
    		?>
    	<?php endif; ?>
        
        <div class="navigation">
            <p class="alignleft"><?php previous_posts_link('Latest posts'); ?></p>
            <p class="alignright"><?php next_posts_link('Older posts'); ?></p>
        </div>
    
    <?php get_footer(); ?>
    Now that may need some changes - because I couldnt check the code + try running it because obviously I dont have access to your setup!

    Hope this helps.

  • #5
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Hi,

    Thanks for the help, I put the code in and on the home page says "Demo custom content" above the slide. I checked to see if I could write anything and it still doesn't work. Do you have any other suggestions? thanks again for the help

    Mark


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •