Created
December 3, 2015 09:23
-
-
Save dkruchok/991edb226b86a5176d65 to your computer and use it in GitHub Desktop.
Counter after p WP
This file contains 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
<div class="frame"> | |
<div class="post-content"> | |
<?php if (!is_single() && of_get_option('of_excerptset')=='1') { | |
$image = wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); ?> | |
<img src="<?php echo $image; ?>"> | |
<?php the_excerpt(); ?> | |
<?php } else { ?> | |
<?php //Removed the original line below ?> | |
<?php //the_content( __('Read more', 'cr') );?> | |
<?php //Added this one insted: ?> | |
<?php //Shoe social buttons after first paragraph | |
$show_after_p = 0; | |
$content = apply_filters('the_content', $post->post_content); | |
if(substr_count($content, '<p>') > $show_after_p) | |
{ | |
$contents = explode("</p>", $content); | |
$p_count = 0; | |
foreach($contents as $content) | |
{ | |
echo $content; | |
if($p_count == $show_after_p) | |
{ | |
?> | |
<?php if (is_single()) { echo do_shortcode("[easy-social-share]"); } ?> | |
<?php | |
} | |
echo "</p>"; | |
$p_count++; | |
} | |
} | |
?> | |
<?php //remove the above ?> | |
<?php if(is_single()) { ?> | |
<div class="pagelink"> | |
<?php wp_link_pages(); ?> | |
</div> | |
<?php } ?> | |
<?php } ?> | |
</div> | |
</div><!-- frame --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment