Last active
February 24, 2016 03:16
-
-
Save great2gether/737dc3fdd9f46d88320c to your computer and use it in GitHub Desktop.
DIVI childtheme index.php file to add a read more link in category & archive
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php get_header(); ?> | |
<div id="main-content"> | |
<div class="container"> | |
<div id="content-area" class="clearfix"> | |
<div id="left-area"> | |
<?php | |
if ( have_posts() ) : | |
while ( have_posts() ) : the_post(); | |
$post_format = et_pb_post_format(); ?> | |
<article id="post-<?php the_ID(); ?>" <?php post_class( 'et_pb_post' ); ?>> | |
<?php | |
$thumb = ''; | |
$width = (int) apply_filters( 'et_pb_index_blog_image_width', 1080 ); | |
$height = (int) apply_filters( 'et_pb_index_blog_image_height', 675 ); | |
$classtext = 'et_pb_post_main_image'; | |
$titletext = get_the_title(); | |
$thumbnail = get_thumbnail( $width, $height, $classtext, $titletext, $titletext, false, 'Blogimage' ); | |
$thumb = $thumbnail["thumb"]; | |
et_divi_post_format_content(); | |
if ( ! in_array( $post_format, array( 'link', 'audio', 'quote' ) ) ) { | |
if ( 'video' === $post_format && false !== ( $first_video = et_get_first_video() ) ) : | |
printf( | |
'<div class="et_main_video_container"> | |
%1$s | |
</div>', | |
$first_video | |
); | |
elseif ( ! in_array( $post_format, array( 'gallery' ) ) && 'on' === et_get_option( 'divi_thumbnails_index', 'on' ) && '' !== $thumb ) : ?> | |
<a href="<?php the_permalink(); ?>"> | |
<?php print_thumbnail( $thumb, $thumbnail["use_timthumb"], $titletext, $width, $height ); ?> | |
</a> | |
<?php | |
elseif ( 'gallery' === $post_format ) : | |
et_pb_gallery_images(); | |
endif; | |
} ?> | |
<?php if ( ! in_array( $post_format, array( 'link', 'audio', 'quote' ) ) ) : ?> | |
<?php if ( ! in_array( $post_format, array( 'link', 'audio' ) ) ) : ?> | |
<h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> | |
<?php endif; ?> | |
<?php | |
et_divi_post_meta(); | |
if ( 'on' !== et_get_option( 'divi_blog_style', 'false' ) || ( is_search() && ( 'on' === get_post_meta( get_the_ID(), '_et_pb_use_builder', true ) ) ) ) { | |
the_content(); // content instead of truncate | |
?> | |
<br><!-- Anpassung Read more link & oben content statt truncate --> | |
<div class="readmore"> | |
<a href="<?php the_permalink(); ?>">Weiterlesen...</a> | |
</div> | |
<?php | |
} else { | |
the_content(); | |
} | |
?> | |
<?php endif; ?> | |
</article> <!-- .et_pb_post --> | |
<?php | |
endwhile; | |
if ( function_exists( 'wp_pagenavi' ) ) | |
wp_pagenavi(); | |
else | |
get_template_part( 'includes/navigation', 'index' ); | |
else : | |
get_template_part( 'includes/no-results', 'index' ); | |
endif; | |
?> | |
</div> <!-- #left-area --> | |
<?php get_sidebar(); ?> | |
</div> <!-- #content-area --> | |
</div> <!-- .container --> | |
</div> <!-- #main-content --> | |
<?php get_footer(); ?> | |
<!-- HEY DUDE! You need to add this into your themes style.css!! and then delete it from here | |
/* Spezial Read More Button für den Kategorie Bereich */ | |
.readmore { | |
border-radius: 1px 7px 7px 1px; | |
color: #fff !important; | |
margin-top: -20px; | |
padding: 0 10px; | |
width: -moz-fit-content; | |
background: #686868 none repeat scroll 0 0; | |
} | |
.readmore:hover { | |
background: #000 none repeat scroll 0 0; | |
} | |
.readmore a { | |
color: #fff; | |
font-weight: bold; | |
} | |
--> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Wow you are a great programmer! Did you make google?