WordPress.org

Ready to get started?Download WordPress

Forums

Aside Format (2 posts)

  1. kbanor
    Member
    Posted 11 months ago #

    Dear All,

    I am a new user desperately in need, can someone help me edit this code to allow aside formats to be active.

    I have already added the "aside" format in functions.php and the option of aside format is available. opening my loop-entry.php, the code below is what i have but do not know how to edit it to display "aside" format and image.

    <?php
    global $data;
    $count=0;
    while (have_posts()) : the_post();
    $count++;
    ?>  
    
    <?php
    /*-----------------------------------------------------------------------------------*/
    // Posts Entry  - used in the blog page & archives
    /*-----------------------------------------------------------------------------------*/
    
    $margin = '';
    if($count == '2') $margin = 'remove-margin';
    ?>
    <article id="post-<?php the_ID(); ?>" <?php post_class('loop-entry boxframe '. $margin .''); ?>>
    
    	<?php
    	//get image height value
    	if($data['entry_thumbnail_height']) {
    		$entry_thumbnail_height = $data['entry_thumbnail_height'];
    	} else {
    		$entry_thumbnail_height = '200';
    	}
    
    	//featured image
    	$thumb = get_post_thumbnail_id();
    	$img_url = wp_get_attachment_url($thumb,'full'); //get full URL to image
    	$featured_image = aq_resize( $img_url, 303, $entry_thumbnail_height, true ); //resize & crop the image
    
    	//show featured image if it exists
    	if($featured_image) {  ?>
        <div class="loop-entry-thumbnail">
            <a>" title="<?php the_title(); ?>">
                <img src="<?php echo $featured_image; ?>" alt="<?php echo the_title(); ?>" />
            </a>
        </div>
        <!-- /loop-entry-thumbnail -->
    	<?php } ?>
        <div class="loop-entry-details">
            <h2><a>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
           <?php echo wp_trim_words( get_the_content(), 25, '...' ); ?><a>" class="read-more"><?php _e('read more','fitnessmag'); ?> →</a>
    		<section class="loop-entry-meta">
    			<?php echo get_the_date(); ?> - <?php comments_popup_link( __( '0 Comments', 'fitnessmag' ), __( '1 Comment', 'fitnessmag' ), __( '% Comments', 'fitnessmag' ) ) ?>
    		</section><!--/post-meta -->
        </div>
        <!-- /loop-entry-details -->
    </article><!-- /entry -->
    
    <?php if($count == '2') { echo '<div class="clear"></div>'; $count=0; } endwhile; ?>


    [Please use the code buttons when posting code - as is, your code may have been corrupted]

  2. paulwpxp
    Font hero
    Posted 11 months ago #

    Post formats already active since you add it in functions.php, the rest of it depends on you want to do with that format.

    For aside, mostly you won't need to do anything to the template, just hide the post's title using CSS, write something short in the content, there you got post format aside.

    If you want to do something with template, depends on how your theme calls the loop part, mostly it goes like content-format.php or loop-format.php, all you have to do is having that file in your theme, copy the standard (normal) one and rename it like content-aside.php or loop-aside.php and do whatever you want.

Reply

You must log in to post.

About this Topic