• Hi

    I am a copy-paste coder so I work on instinct instead of knowledge, and I am looking for how this hack-and mix theme selects its front page posts.

    I would like to assign a category called “frontpage” and use it to control what is shown on the first page. Not quite sure how the selection is made now. Date maybe?

    https://bobbygood.de.s47775.gridserver.com/

    Thank you

    holby

    <?php get_header(); ?>
    <div id="introduction" class="grid_8">
    	<h2><?php if ( function_exists( 'get_option_tree') && get_option_tree( 'workaholic_quote_one') <>'') { echo get_option_tree( 'workaholic_quote_one'); } else { ?> Hi! We design beautiful websites. <?php } ?></h2>
    	<h3><?php if ( function_exists( 'get_option_tree') && get_option_tree( 'workaholic_quote_two') <>'') { echo get_option_tree( 'workaholic_quote_two'); } else { ?>Not just beautiful but usable websites. Be sure to check out what we have done and <a href="#">contact us</a> if you want to improve yours as well.<?php } ?></h3>
    </div>
    
    <hr class="grid_12" />
    	<div id="content" class="grid_12">
    
    	    <?php
    	    // Grab Option Tree theme options
            if (function_exists( 'get_option_tree') ) { $options = get_option_tree( 'option_tree'); }
    
            // Start Slider
            if (function_exists( 'get_option_tree') && get_option_tree( 'workaholic_homepage',$options) == 'Upload images') {
                $i=0;
                $home_images = get_option_tree('workaholic_home_images',$options,false,true); ?>
                <h2>Latest</h2> 
    
                <?php foreach( $home_images as $image ) { 
    
                    $i++; ?> 
    
                    <div class="portfolio grid_4<?php if ($i == 1) { ?> alpha<?php } else if($i==3) {?> omega<?php $i = 0;} ?>">
                        <h4><a href="<?php if( $image['link'] <> '') { echo $image['link']; } else { echo "#"; } ?>" class="thumb">
            				    <img src="<?php echo $image['image']; ?>" alt="<?php echo $image['title']; ?>" width="284" height="150"  />
                                    <span class="title"><?php echo $image['title']; ?></span></a><span class="category"><?php echo $image['description']; ?></span></h4>
                                    </div>
               <?php } ?>
    
            <?php } else { ?> 
    
    	<?php if (have_posts()) : ?>
    	<?php $i=0; ?>
    	<h2>NEW</h2>
    
    		<?php
    		global $blog_ID;
    		$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    		query_posts('cat=-' . $blog_ID. '&paged='.$paged);
    		while (have_posts()) : the_post();$i++;?>	
    
    			<div class="portfolio grid_4<?php if ($i == 1) { ?> alpha<?php } else if($i==3) {?> omega<?php $i = 0;} ?>">
    				<h4><a href="<?php the_permalink(); ?>" class="thumb">
    					<?php get_the_image( array( 'custom_key' => array( 'thumbnail' ), 'default_size' => 'thumbnail', 'width' => '284', 'height' => '150', 'link_to_post' => false ) ); ?>
    						<span class="title"><?php the_title(); ?></span></a><span class="category"> <?php the_excerpt(' + '); ?>   </span></h4>
    			</div>		
    
    		<?php endwhile; wp_reset_query();?>
    
    	<?php else : ?>
    
    		<h2 class="center">Not Found</h2>
    		<p class="center">Sorry, but you are looking for something that isn't here.</p>
    		<?php get_search_form(); ?>
    
    	<?php endif; ?>
    
    	<?php } ?> 
    
    	</div>
    
    <?php get_footer(); ?>
Viewing 3 replies - 1 through 3 (of 3 total)
  • It looks like the code is using the Option Tree plugin to assign images for the home page.

    Go to Admin->Option Tree->Theme Options, and look for options with ‘Home Images’ in the title.

    Thread Starter holby

    (@holby)

    Hi

    I had a look I don’t think thats it. I have to understand where to change how the choice is made what to put on the front page. I wand it to use a category instead of date or whatever it does now.

    It isn’t an option, I have to identify it in the code somehow

    thank you

    holby

    OK – if the Option Tree option is not used, it looks like the posts will be selected in date order, newest first.

    This is the query that selects the posts:

    query_posts('cat=-' . $blog_ID. '&paged='.$paged);

    it is already excluding the category with an id of $blog_ID, so you would add the id of the category that you want to include. Assuming the id of the ‘frontpage’ category is ’17’, this should work:

    query_posts('cat=-' . $blog_ID . ',17&paged='.$paged);
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘front page selection’ is closed to new replies.