Forum Replies Created

Viewing 14 replies - 16 through 29 (of 29 total)
  • Thread Starter swollenpickles

    (@swollenpickles)

    thanks I’ll take a look at that tonight.

    Thread Starter swollenpickles

    (@swollenpickles)

    I was thinking something like this, but can’t get it functioning:

    <?php if (is_page('Portfolios')) {
    	$pages = get_pages('child_of='.$post->ID.'&sort_column=post_date&sort_order=desc');
    	$count = 0;
    	foreach($pages as $page)
    	{
    		$content = $page->post_content;
    		if(!$content)
    			continue;
    		if($count >= 2)
    			break;
    		$count++;
    		$content = apply_filters('the_content', $content);
    	?>
    		<h2><a href="<?php echo get_page_link($page->ID) ?>"><?php echo $page->post_title ?></a></h2>
    		<div class="entry"><?php echo $content ?></div>
    	<?php
    	}	
    
    } else {
    		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    		<div class="post" id="post-<?php the_ID(); ?>">
    		<h2><?php the_title(); ?></h2>
    			<div class="entry">
    				<?php the_content('<p class="serif">Read the rest of this page &raquo;</p>'); ?>
    
    				<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
    
    			</div>
    		</div>
    		<?php endwhile; endif; ?>
    	<?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
    <?php } ?>
    Thread Starter swollenpickles

    (@swollenpickles)

    Thanks. It’s not so much the thumbnail thing I’m having problems with, but more how to display the children of the page if the page has a specific title (eg. Portfolios).

    Thread Starter swollenpickles

    (@swollenpickles)

    Thank you Michael, that worked a treat!

    Thread Starter swollenpickles

    (@swollenpickles)

    Thank you for the reply. I replaced the dashes with underscores and it works a treat now.

    Thread Starter swollenpickles

    (@swollenpickles)

    Thanks, here’s the revised page code I’m using:

    <?php get_header(); ?>
    
    <?php get_sidebar(); ?>
    
    	<div id="content">
    
    	<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    		<?php $sample-image = get_post_meta($post->ID, 'sample-image', $single = true); ?>
    			<div id="sample-image">
    
    				<?php // if there's a thumbnail
    				if($sample-image !== '') { ?>
    					<p>
    						<img src="<?php echo $sample-image; ?>" />
    					</p>
    				<?php } ?>
    			</div>
    
    		<div class="post-single" id="post-single-<?php the_ID(); ?>">
    
    			<h2><?php the_title(); ?></h2>
    
    			<div class="entry">
    
    				<?php the_content('<p class="serif">Read the rest of this entry &raquo;</p>'); ?>
    
    				<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
    				<?php the_tags( '<p>Tags: ', ', ', '</p>'); ?>
    
    				<p class="postmetadata alt">
    					<small>
    						Filed under <?php the_category(', ') ?>.
    					</small>
    				</p>
    
    			</div>
    		</div>
    
    		<div class="navigation">
    			<div class="alignleft"><?php previous_post_link('&laquo; %link') ?></div>
    			<div class="alignright"><?php next_post_link('%link &raquo;') ?></div>
    		</div>
    
    	<?php endwhile; else: ?>
    
    		<p>Sorry, no posts matched your criteria.</p>
    
    <?php endif; ?>
    
    	</div>
    
    <?php get_footer(); ?>

    I’m getting this error message when attempting to view a single post:
    Parse error: parse error, unexpected ‘=’ in \themes\template\single.php on line 8

    This is line 8:
    <?php $sample-image = get_post_meta($post->ID, 'sample-image', $single = true); ?>

    Thread Starter swollenpickles

    (@swollenpickles)

    Bump, cos I still can’t figure this out.

    Thread Starter swollenpickles

    (@swollenpickles)

    Anyone?

    Thread Starter swollenpickles

    (@swollenpickles)

    Anyone?

    Thread Starter swollenpickles

    (@swollenpickles)

    bump?

    Thread Starter swollenpickles

    (@swollenpickles)

    Thanks for the reply. It looks like I’ve figured it out!

    Just to clarify in case anyone else is trying to do something similar, my category structure currently looks like this.

    Parent Category 1
    – cat 1 child 1
    – cat 1 child 2

    Parent Category 2
    – cat 2 child
    – cat 2 child 2

    In my dropdown menu I wanted to display the listing of all children under parent category 1 for example.

    Here’s what I’ve used.

    <form action="<?php bloginfo('url'); ?>" method="get">
             <?php wp_list_categories('orderby=id&show_count=1&use_desc_for_title=0&child_of=7'); ?>
          <input type="submit" name="submit" value="view" />
       </form>
    Thread Starter swollenpickles

    (@swollenpickles)

    bump?

    Thread Starter swollenpickles

    (@swollenpickles)

    Any ideas?

    Thread Starter swollenpickles

    (@swollenpickles)

    Cool, thanks. Only problem is, I’m hot sure how to include that in the code to get it to work.

    Here’s what I’m working with at the moment:

    <h2 class="section-header">Recent Headlines &raquo;</h2>
    
    <?php
    // THE SECOND LOOP SHOWING THE ARTICLES AFTER THE FEATURE
    if (have_posts()) :
    $i = 1;
    while (have_posts()) : the_post();
    if( $post->ID == $do_not_duplicate ) continue; update_post_caches($posts);
    
    // CHECKS TO SEE IF THERE'S AN IMAGE FOR THIS POST
    $thumb = get_post_meta($post->ID, 'Thumbnail', $single = true);
    // CHECKS TO SEE IF THERE'S A SET ALT TEXT FOR THIS IMAGE
    $thumb_alt = get_post_meta($post->ID, 'Thumbnail Alt', $single = true);
    ?>
    
    <?php // for controlling the layout of the home pages bottom excerpts up to 10 posts
    if($i == '1' || $i == '3' || $i == '5' || $i == '7' || $i == '9') { ?>
    <div class="secondary">
    <?php } // endif ?>
    
    	<div class="<?php if($i % 2 == 0) { echo 'post-right'; } else { echo 'post-left';} ?>">
    	<div id="post-<?php the_ID(); ?>" class="post">
    	<h2 class="post-title"><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
    	<div class="entry">
    	<?php if($thumb !== '') {
    		?>
    		<p>
    		<img src="<?php echo $thumb?>" alt="<?php if($thumb_alt !== '') echo $thumb_alt; else echo the_title; ?>" class="left" />
    		</p>
    	<?php } ?>
    	<p class="byline"><?php the_time('F jS, Y') ?></p>
    	<?php the_excerpt(); ?>
    	<p><?php edit_post_link('Edit', '', ' | '); ?><?php comments_popup_link('No Comments', '1 Comment', '% Comments'); ?> | <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">Read full story &raquo;</a></p>
    	</div><!-- entry -->
    	</div><!-- post -->
    	</div><!-- post left or right -->
    
    <?php // for controlling the layout of the home pages bottom excerpts up to 10 posts
    if($i == '2' || $i == '4' || $i == '6' || $i == '8' || $i == '10') { ?>
    </div><!-- secondary -->
    <?php } // endif ?>
    <?php $i++; ?>
    <?php endwhile; endif; ?>
Viewing 14 replies - 16 through 29 (of 29 total)