- This topic has 6 replies, 3 voices, and was last updated 9 years, 9 months ago by Theme Horse Support Team.
-
AuthorPosts
-
April 10, 2014 at 5:44 pm #9418ekwebParticipant
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):
<?phpadd_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’ ); ?>
<?phpif( 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;
?>April 10, 2014 at 6:17 pm #9420ekwebParticipantHere 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 ErwinApril 14, 2014 at 2:16 pm #9500Theme Horse Support TeamKeymasterHi 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
SunilApril 15, 2014 at 7:01 pm #9525ekwebParticipantHi Sunil,
thanks for your answer. I will try next weekend.
Would be great if this could be set in the options.
Thank you
erwinApril 16, 2014 at 12:38 pm #9537Theme Horse Support TeamKeymasterOk Sure
regards
SunilJuly 24, 2014 at 4:28 pm #12460david.danaanParticipantHello 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.
July 25, 2014 at 7:22 am #12482Theme Horse Support TeamKeymasterHi 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! -
AuthorPosts
- You must be logged in to reply to this topic.