Forum Replies Created

Viewing 10 replies - 1 through 10 (of 10 total)
  • To move the comment box to the right to accommodate a left sidebar in the twentythirteen theme, the following code works well for me:

    .sidebar .comments-title, .sidebar .comment-list, .sidebar .must-log-in, .sidebar .comment-reply-title, .sidebar .comment-navigation, .sidebar .comment-respond .comment-form {
    	max-width: 1040px;
    	padding: 0 60px 0 340px;
    }
    Thread Starter Caneval

    (@caneval)

    I’ve tried various ways to attach a word limit to the sum of words from an excerpt and title to no avail. Is there any way this can be done??

    Thread Starter Caneval

    (@caneval)

    There must be a way that this can be done. For example, if on the homepage/index.php I push the posts’ IDs into an array called $homeids, how could my recent posts column/sidebar.php template access and exclude $homeids from being displayed?

    Thread Starter Caneval

    (@caneval)

    Okay, solved my own problem – finally!

    I adapted code from the following:
    http://wp-snippets.com/avoid-duplicate-posts-in-multiple-loops/
    And it works beautifully so far.

    My index.php now looks like:

    Latest posts:

    div class="latestpost">
    
    <?php if (have_posts()) : ?>
    <?php query_posts("showposts=1"); // show one latest post only ?>
    <?php
    $ids = array();
    while (have_posts()) : the_post();
    ?>
    
    <?php do_atomic( 'before_entry' ); // origin_before_entry ?>
    <div id="post-<?php the_ID(); ?>" class="<?php hybrid_entry_class(); ?>">
    <?php do_atomic( 'open_entry' ); // origin_open_entry ?>
    
    ---content---
    
    <?php do_atomic( 'close_entry' ); // origin_close_entry ?>
    </div><!-- .hentry -->
    
    <?php $ids[]= $post->ID; ?>
    
    <?php do_atomic( 'after_entry' ); // origin_after_entry ?>
    <?php endwhile; ?>
    <?php query_posts("showposts=5&offset=1"); // show 4 latests posts excluding the latest ?>
    <?php else : ?>
    <?php get_template_part( 'loop-error' ); // Loads the loop-error.php template. ?>
    <?php endif; ?>
    </div><!-- .latestpost -->

    Featured posts:

    <div class="ifeed"; /*third column*/ >
    
    <?php
    query_posts("category_name=featured&showposts=3");
    while (have_posts()) : the_post();
    if (!in_array($post->ID, $ids)) {
    ;?>
    
    ---content---
    
    <?php }
    endwhile; ?>
    <?php wp_reset_query(); ?>
    </div><!-- .ifeed -->

    Hope that helps someone!

    Thread Starter Caneval

    (@caneval)

    Okay well I solved my own problem. I added a new div, pasted a post loop inside, and to specify the number and type of posts I wanted the column to list, I inserted the following code in the relevant template (for me, that’s the index.php file) below the start of the div code “<div class=”[name]”> “

    <?php
     $topbox = get_posts('numberposts=3&category=8');
     foreach($topbox as $post) :
        setup_postdata($post);
     ?>
    
    --content, e.g. post title, thumbnail info, excerpt info goes here--
    
     <?php endforeach; ?>
    </div>

    Edit how you see fit.

    Then I changed the width of columns via CSS so they appear on the homepage.

    I can’t say if my solution is the correct and cleanest way, but so far it’s working fine.

    Thread Starter Caneval

    (@caneval)

    *Bump* So how can a wordpress user define elements in PHP, so they can be edited separately to other elements?

    What I want to do is move a post’s content to sit above an image in a featured post, for example, but to have content sit below the image in normal posts. I hope someone can help.

    Thread Starter Caneval

    (@caneval)

    Thanks WPyogi, I understand. I thought separating and styling individual elements would be a task! Here’s hoping someone has the answer as it could prove very useful.

    Thread Starter Caneval

    (@caneval)

    Almost there – your first code worked a treat – again, many thanks. Just so I can understand how it works – how did you know about that “.sticky-header h2.entry-title {} CSS code? Since it wasn’t in the original stylesheet.

    Moving the php code does place the post summary text below the image, but it does that for all the posts – is there a way for us to define the featured post/featured post summary separately (e.g. give it a different class?) to the normal posts, so the ‘summary text’ can be moved without affecting them? I appreciate this may be complicated, but knowing how to achieve this could help when editing other elements.

    Thank you for your help so far.

    Thread Starter Caneval

    (@caneval)

    Spot on, your advice works and thank you for being clear. The only issue now is removing the big white space under the header. I could use [e.g.] margin-bottom: -14px; to remove it, but is that good practice or is there a better way?

    Lastly, I want the body text to sit above the featured post image (as it is), and to the right of the non-featured posts’ thumbnails below. This code is in the index.php file, which is what I’ve been editing and is what the page uses – is this what you mean?

    <?php
    /**http://www.thelayreporter.com/
     * Index Template
     *
     * This is the default template.  It is used when a more specific template can't be found to display
     * posts.  It is unlikely that this template will ever be used, but there may be rare cases.
     *
     * @package Origin
     * @subpackage Template
     */
    
    get_header(); // Loads the header.php template. ?>
    
    	<?php do_atomic( 'before_content' ); // origin_before_content ?>
    
    	<div id="content">
    
    		<?php do_atomic( 'open_content' ); // origin_open_content ?>
    
    		<div class="hfeed">
    
    			<?php if ( have_posts() ) : ?>
    
    				<?php while ( have_posts() ) : the_post(); ?>
    
    					<?php do_atomic( 'before_entry' ); // origin_before_entry ?>
    
    						<div id="post-<?php the_ID(); ?>" class="<?php hybrid_entry_class(); ?>">
    
    							<?php do_atomic( 'open_entry' ); // origin_open_entry ?>
    
    							<div class="sticky-header">
    
    								<?php echo apply_atomic_shortcode( 'entry_title', '[entry-title]' ); ?>
    
    							</div><!-- .sticky-header -->
    
    								<div class="entry-summary">
    
    								<?php the_excerpt(); ?>
    
    								<?php wp_link_pages( array( 'before' => '<p class="page-links">' . __( 'Pages:', 'origin' ), 'after' => '</p>' ) ); ?>
    
    							</div><!-- .entry-summary -->
    
    							<?php if ( current_theme_supports( 'get-the-image' ) ) {
    
    								if ( is_sticky ( $post->ID ) ) {
    
    									get_the_image( array( 'meta_key' => 'Thumbnail', 'size' => 'single-thumbnail', 'image_class' => 'featured' ) );
    
    								} else {
    
    									get_the_image( array( 'meta_key' => 'Thumbnail', 'size' => 'thumbnail', 'image_class' => 'featured' ) );
    
    								}
    
    							} ?>
    
    							<?php do_atomic( 'close_entry' ); // origin_close_entry ?>
    
    						</div><!-- .hentry -->
    
    					<?php do_atomic( 'after_entry' ); // origin_after_entry ?>
    
    				<?php endwhile; ?>
    
    			<?php else : ?>
    
    				<?php get_template_part( 'loop-error' ); // Loads the loop-error.php template. ?>
    
    			<?php endif; ?>
    
    		</div><!-- .hfeed -->
    
    		<?php do_atomic( 'close_content' ); // origin_close_content ?>
    
    		<?php get_template_part( 'loop-nav' ); // Loads the loop-nav.php template. ?>
    
    	</div><!-- #content -->
    
    	<?php do_atomic( 'after_content' ); // origin_after_content ?>
    
    <?php get_footer(); // Loads the footer.php template. ?>
    Thread Starter Caneval

    (@caneval)

    Thank you WPyogi, I guess it is a complex problem. I’ve looked at the link but will try making a template when I’ve learnt more about the coding.

    Upwards and onwards.

Viewing 10 replies - 1 through 10 (of 10 total)