Forum Replies Created

Viewing 13 replies - 61 through 73 (of 73 total)
  • I have used this great bit of code for something i have been working on…

    <?php
    
    		$page = (get_query_var('paged')) ? get_query_var('paged') : 1;
    		$postcnt = 0; query_posts('cat=3,4,5,6');
    		if (have_posts()) { ?>
    			<div class="example">
    		<ul class="content_cols">
    			<?php
    			while ( have_posts() ) : the_post(); $postcnt++; $data = get_post_meta( $post->ID, 'key', true );?>
    
    				<li class="cat<?php $category = get_the_category(); echo $category[0]->cat_ID;?>">
    
    <h3><?php the_title(); ?></h3>
    <p><?php echo $data[ 'event_date' ]; ?></p>
    <p><?php echo $data[ 'event_location' ]; ?></p>
    <p><?php echo $data[ 'event_time' ]; ?></p>
    <p><a href="<?php the_permalink() ?>" title="View more details of <?php the_title(); ?>">Read More</a></p>
    <div class="clearFix"><!--x--></div>
    </li>
    
    				<?php if($postcnt % 6 == 0) { ?>
    
    					<?php if($postcnt % 6 == 0) { ?>
    					</ul>
    					<div class="line"></div>
    					<div class="clearFix"><!--x--></div>
    						</div>
    
    						<div class="example">
    					<?php } ?>
    					<ul class="content_cols">
    				<?php } ?>
    			<?php
    			endwhile; ?>
    			</ul>
    			<div class="clearFix"><!--x--></div>
    			</div>
    			<?php
    		} ?>

    However, when i get to 24, 6 columns of 6 rows it prints a blank div.example, obviously i dont want a blank one at the end i just want it to stop printing and cut off when it gets to 24 not include 1 more after.

    Any ideas?

    Thread Starter jezthomp

    (@jezthomp)

    I’ve managed to get it partly working here..

    <div class="example">
    		<ul class="content_cols">
    
    		<?php while (have_posts()) : the_post();     $data = get_post_meta( $post->ID, 'key', true );?>
    
    		<li class="cat<?php $category = get_the_category(); echo $category[0]->cat_ID;?>">
    
    <h3><?php the_title(); ?></h3>
    
    <div class="clearFix"><!--x--></div>
    		</li>
    
    						<?php if($postcnt % 2 == 0) { ?>
    						<?php if($postcnt % 6 == 0) { ?>
    					</ul>
    					<div class="line"></div>
    					<div class="clearFix"><!--x--></div>
    						</div>
    
    						<div class="example">
    					<?php } ?>
    					<ul class="content_cols">
    				<?php } ?>
    			<?php
    			endwhile; ?>
    			</ul>
    			<div class="clearFix"><!--x--></div>
    			</div>
    
    	<?php else :
    
    		if ( is_category() ) { // If this is a category archive
    			printf("<h2>Sorry, but there aren't any posts in the %s category yet.</h2>", single_cat_title('',false));
    		} 
    
    	endif;
    ?>

    However, its only putting one li in each .example div, rather than putting 6 li into one div.
    Stuck now 🙁

    Thread Starter jezthomp

    (@jezthomp)

    Manged to get this one working, the best way to do it though?

    <h2><?php
    
    if(is_page(21))
    {
    	echo 'Welcome to my home page';
    }
    elseif (is_page(23))
    {
    	echo 'this is page 23';
    }
    elseif (is_page(24))
    {
    	echo 'this is page 23';
    }
    
    ?></h2>

    Thread Starter jezthomp

    (@jezthomp)

    Thanks esmi/t31os

    I need it to work in a particular way, not the browser title but in the main body title above the main body text.

    So..

    <h2>
    <?php if(is_front_page()) echo 'Welcome to'; ?> <?php bloginfo('name');  echo 'test name'; ?> </h2>

    Works great but there is no space before ‘test name’

    Also a range of pages needs its own title, can this be done.

    For example..

    If home page the above one..
    If is_page(23): print welcome to page 23,If is_page(24): print this is page 24,If is_page(25): print important page 25,If is_page(26): print different page 26,If is_page(27): print welcome to page 27 etc etc

    Can that be done?

    Gave it a go here but didnt work 🙁

    <h2>
    		<?php if(is_front_page()) echo 'Welcome to'; ?><?php bloginfo('name');  echo 'Test Blog'; ?>
    		<?php if(is_page(23) echo 'welcome to page 23';?>
    		<?php if(is_page(24) echo 'this is page 24'; ?>
    
    		</h2>

    Thanks 🙂

    Thread Starter jezthomp

    (@jezthomp)

    I see thanks for that.

    I assume this would only work with the front page, could add a page id?

    For example this is page id 40 print this instead of page name?

    Thread Starter jezthomp

    (@jezthomp)

    Wow thanks for that.

    Mind explaining what it does?

    Many thanks 🙂

    Thread Starter jezthomp

    (@jezthomp)

    Managed to figure it out so will put here if anyone needs it 🙂

    <?php wp_list_pages('exclude=30&title_li=' . __('') . '' ); ?>

    Thanks for you help MAC 🙂

    Thread Starter jezthomp

    (@jezthomp)

    Unfortunately that doesn’t work its still printing the “pages” 🙁

    Even tried <?php wp_list_pages('exclude=17,38'.'' ); ?>

    But still prints the ‘page’ text.

    Thread Starter jezthomp

    (@jezthomp)

    No i’m building local, sorry.

    Basically i have <?php wp_list_pages(‘title_li’ ); ?> this in my header for my main navigation.

    Ignore the sidebar or widgets that doesn’t come into this.

    I need the main navigation to just be that, whilst excluding certain pages and not printing ‘pages’ before it.

    Thread Starter jezthomp

    (@jezthomp)

    Because its for main main navigation not any sidebar widgets.

    Regardless i have a couple of individual sidebars working with individual templates.

    This is just for the main navigation at the top of the site.

    Thread Starter jezthomp

    (@jezthomp)

    Here is the admin login link.

    http://www.19at.co.uk/wp/wp-login.php

    When i try and login or click forget password i just get this re-direct.

    http://www.19at.co.uk/?step=2/wp-login.php?action=lostpassword

    Thread Starter jezthomp

    (@jezthomp)

    Nope no luck.

    Still on the install.php page and still not loading the style etc 🙁

    Thread Starter jezthomp

    (@jezthomp)

    Nobody have any idea?

    Can it even be done multiple posts within one page?

    🙁

Viewing 13 replies - 61 through 73 (of 73 total)