badget

Biggest Sale! Special Offer!

Get 30% discount on all of our single themes with this coupon code: #30%SALE

Hurry up! *Limited time offer*

attitude_theloop_for_archive –> attitude_theloop_for_template_blog_image_medium

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #9418
    ekweb
    Participant

    I would like, that my archive pages look same like the template_blog_image_medium. I tried to work this out with unhooking the function attitude_theloop_for_archive, but it did not work for me.

    Problems I have:

    • I dont get the right category posts
    • It does not show the right CSS

    Can you please help me

    Here is my code (child function.php):
    <?php

    add_action( ‘init’, ‘attitude_remove_parent_function’ );
    /**
    * Removes parent function attached to hook
    */
    function attitude_remove_parent_function(){

    remove_action(‘attitude_loop_content’,’attitude_theloop_for_archive’, 10);
    }
    add_action(‘attitude_loop_content’,’attitude_child_theloop_for_archive’, 10);

    /* Shows the loop content */

    if ( ! function_exists( ‘attitude_child_theloop_for_archive’ ) ) :

    /**
    * Fuction to show the archive loop content.
    */
    function attitude_child_theloop_for_archive() {
    global $post;
    global $attitude_theme_options_settings;
    $options = $attitude_theme_options_settings;
    if( have_posts() ) {
    while( have_posts() ) {
    the_post();
    do_action( ‘attitude_before_post’ );

    ?>
    <section id=”post-<?php the_ID(); ?>” <?php post_class(); ?>>
    <article>
    <?php do_action( ‘attitude_before_post_header’ ); ?>

    <header class=”entry-header”>
    <h2 class=”entry-title”> ” title=”<?php the_title_attribute();?>”>
    <?php the_title(); ?>
    </h2>
    <!– .entry-title –>
    </header>
    <?php do_action( ‘attitude_after_post_header’ ); ?>
    <?php do_action( ‘attitude_before_post_content’ ); ?>
    <?php

    if( has_post_thumbnail() ) {
    $image = ”;
    $title_attribute = apply_filters( ‘the_title’, get_the_title( $post->ID ) );
    $image .= ‘<figure class=”post-featured-image”>’;
    $image .= ‘‘;
    $image .= get_the_post_thumbnail( $post->ID, ‘featured-medium’, array( ‘title’ => esc_attr( $title_attribute ), ‘alt’ => esc_attr( $title_attribute ) ) ).’
    ‘;
    $image .= ‘</figure>’;
    echo $image;
    }

    ?>
    <?php the_excerpt(); ?>
    <?php do_action( ‘attitude_after_post_content’ ); ?>
    <?php do_action( ‘attitude_before_post_meta’ ); ?>
    <div class=”entry-meta-bar clearfix”>
    <div class=”entry-meta”> <span class=”by-author”>
    <?php _e( ‘By’, ‘attitude’ ); ?>
    “>
    <?php the_author(); ?>
    </span> | <span class=”date”>” title=”<?php echo esc_attr( get_the_time() ); ?>”>
    <?php the_time( get_option( ‘date_format’ ) ); ?>
    </span> |
    <?php if( has_category() ) { ?>
    <span class=”category”>
    <?php the_category(‘, ‘); ?>
    </span> |
    <?php } ?>
    <?php if ( comments_open() ) { ?>
    <span class=”comments”>
    <?php comments_popup_link( __( ‘No Comments’, ‘attitude’ ), __( ‘1 Comment’, ‘attitude’ ), __( ‘% Comments’, ‘attitude’ ), ”, __( ‘Comments Off’, ‘attitude’ ) ); ?>
    </span> |
    <?php } ?>
    </div>
    <!– .entry-meta –>
    <?php
    echo ‘‘.$options[ ‘post_excerpt_more_text’ ].’‘;

    ?>
    </div>
    <?php do_action( ‘attitude_after_post_meta’ ); ?>
    </article>
    </section>
    <?php
    do_action( ‘attitude_after_post’ );
    }
    }
    else {
    ?>
    <h1 class=”entry-title”>
    <?php _e( ‘No Posts Found.’, ‘attitude’ ); ?>
    </h1>
    <?php
    }
    }
    endif;
    ?>

    #9420
    ekweb
    Participant

    Here is the page how the category-pages should look like:
    http://www.kargl.co.at/aktuelles/
    and here is one of the category-pages:
    http://www.kargl.co.at/category/organisationsentwicklung/
    They should have the same layout, the template_blog_image_medium layout.
    Thank you Erwin

    #9500

    Hi Ekweb
    Create child theme and unhook the function of archive from library->structure->content-0xtension.php and write the same function and you can change the image. In archive page there is blog image large. So you need to fix it to blog image medium.

    function interface_theloop_for_archive() {
    	global $post;
    
    	if( have_posts() ) {
    		while( have_posts() ) {
    			the_post();
    
    			do_action( 'interface_before_post' );
    ?>
    	<section id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    	 				<?php do_action( 'interface_before_post_header' ); ?>
    	 	<article>
    								<?php
    				if( has_post_thumbnail() ) {
    					$image = '';        			
    		     		$title_attribute = apply_filters( 'the_title', get_the_title( $post->ID ) );
    		     		$image .= '<figure class="post-featured-image">';
    		  			$image .= '<a href="' . get_permalink() . '" title="'.the_title( '', '', false ).'">';
    		  			$image .= get_the_post_thumbnail( $post->ID, 'featured', array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $title_attribute ) ) ).'</a>';
    					$image .='<span class="arrow"></span>';
    		  			$image .= '</figure>';
    
    		  			echo $image;
    		  		}
    	  			?>

    In this line
    $image .= get_the_post_thumbnail( $post->ID, 'featured', array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $title_attribute ) ) ).'</a>';
    instead of featured you keep featured-medium
    Regards
    Sunil

    #9525
    ekweb
    Participant

    Hi Sunil,
    thanks for your answer. I will try next weekend.
    Would be great if this could be set in the options.
    Thank you
    erwin

    #9537

    Ok Sure
    regards
    Sunil

    #12460
    david.danaan
    Participant

    Hello Sunil,

    I made the above change to the content-extensions.php template, and the archive images are now the featured-medium size. However, they do not float left as they do in the blog image medium page template, they are still centered with the excerpt below. This segment of code is (after editing) identical in the functions for archive and blog image medium templates:

    <?php
    			if( has_post_thumbnail() ) {
    				$image = '';        			
    	     		$title_attribute = apply_filters( 'the_title', get_the_title( $post->ID ) );
    	     		$image .= '<figure class="post-featured-image">';
    	  			$image .= '<a href="' . get_permalink() . '" title="'.the_title( '', '', false ).'">';
    	  			$image .= get_the_post_thumbnail( $post->ID, 'featured-medium', array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $title_attribute ) ) ).'</a>';
    	  			$image .= '</figure>';
    
    	  			echo $image;
    	  		}
      			?>

    so where can I find the code that controls this attribute of the image?

    Many thanks.

    #12482

    Hi david.danaan,
    If you want to display same as blog image medium for archive page then copy this code from blog image medium on line no 593 to 650

    <section id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
      <?php do_action( 'interface_before_post_header' ); ?>
      <article>
        <header class="entry-header">
          <div class="entry-meta"> <span class="cat-links">
            <?php the_category(', '); ?>
            </span><!-- .cat-links --> 
          </div>
          <!-- .entry-meta -->
          <h1 class="entry-title"> <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute();?>">
            <?php the_title();?>
            </a> </h1>
          <!-- .entry-title -->
          <div class="entry-meta clearfix">
            <div class="by-author"><a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>" title="<?php  esc_attr(the_author()); ?>">
              <?php the_author(); ?>
              </a></div>
            <div class="date"><a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( get_the_time() ); ?>">
              <?php the_time( get_option( 'date_format' ) ); ?>
              </a></div>
            <?php if ( comments_open() ) { ?>
            <div class="comments">
              <?php comments_popup_link( __( 'No Comments', 'interface' ), __( '1 Comment', 'interface' ), __( '% Comments', 'interface' ), '', __( 'Comments Off', 'interface' ) ); ?>
            </div>
            <?php } ?>
          </div>
          <!-- .entry-meta --> 
        </header>
        <!-- .entry-header -->
        <?php
              if( has_post_thumbnail() ) {
                $image = '';              
                  $title_attribute = apply_filters( 'the_title', get_the_title( $post->ID ) );
                  $image .= '<figure class="post-featured-image">';
                  $image .= '<a href="' . get_permalink() . '" title="'.the_title( '', '', false ).'">';
                  $image .= get_the_post_thumbnail( $post->ID, 'featured-medium', array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $title_attribute ) ) ).'</a>';
                $image .='<span class="arrow"></span>';
                  $image .= '</figure>';
    
                  echo $image;
                }
                ?>
        <div class="entry-content clearfix">
          <?php the_excerpt(); ?>
        </div>
        <!-- .entry-content -->
        <footer class="entry-meta clearfix"> <span class="tag-links">
          <?php $tag_list = get_the_tag_list( '', __( ' ', 'interface' ) );
              if(!empty($tag_list)){
            echo $tag_list;
            
              }?>
          </span><!-- .tag-links --> 
          <?php echo '<a class="readmore" href="' . get_permalink() . '" title="'.the_title( '', '', false ).'">'.$options[ 'post_excerpt_more_text' ].'</a>';
            ?> </footer>
        <!-- .entry-meta --> 
      </article>
    </section>

    and replace the line from 116 to 183 and add the above code.

    That it will works according to the blog image medium as in archive page also.
    Thank you!

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.