[Plugin: Network Latest Posts] Auto Excerpt Everywhere plug-in (exclude pages) ???
-
HELLO!
I am using auto excerpt everywhere but would only like to excerpt my posts not pages. Any idea how to accomplish this? I am at a loss. I don’t want to excerpt the text on my home page, but need to excerpt on my post pages. Thank you for your help!
https://www.ads-software.com/extend/plugins/network-latest-posts/
-
Hi,
Sorry but I don’t understand what you are trying to do, could you please put here the shortcode or parameters you are using? and the site where it displays the results?
Are you mixing posts and pages? if so, I would recommend to use different shortcodes, one with auto excerpt other without it, for example:
This for posts [nlposts auto_excerpt=true cpt=post]
This for pages [nlposts cpt=page]
But I will need further details to be able to offer you a solution.
Cheers.
Hi Jose,
Thanks for your time.
This is the url for site: https://www.humkey.ucsc.edu
home page should be full content,
events (upcoming and past) as well as blog posts should be excerpts. The plugin excerpts content on complete site, pages and posts.this is the php for auto excerpt eveywhere:
//<?php
/*
Plugin Name: Auto Excerpt everywhere
Plugin URI: https://www.josie.it/wordpress/wordpress-plugin-auto-excerpt-everywhere/
Description: The plugin shows excerpts instead of contents in your blog, single posts and pages excluded. It tries to display your custom excerpt text and if it doesn’t find it it will show an automatically generated excerpt. You can also define an excerpt length (default is 500) and a custom read more link.
Version: 1.4
Author: Serena Villa
Author URI: https://www.josie.it
*/function auto_excerpt_everywhere_activation() {
if (!get_option(“excerpt_everywhere_length”)){
update_option(“excerpt_everywhere_length”,”500″);
}
if (!get_option(“excerpt_everywhere_align”)){
update_option(“excerpt_everywhere_align”,”alignleft”);
}
if (!get_option(“excerpt_everywhere_moretext”)){
update_option(“excerpt_everywhere_moretext”,”Read more […]”);
}
if (!get_option(“excerpt_everywhere_rss”)){
update_option(“excerpt_everywhere_rss”,”yes”);
}
if (!get_option(“excerpt_everywhere_thumb”)){
update_option(“excerpt_everywhere_thumb”,”none”);
}
}
function auto_excerpt_everywhere_construct() {
$rss_disable=get_option(“excerpt_everywhere_rss”);
$sticky_disable=get_option(“excerpt_everywhere_sticky”);
if ($rss_disable==”yes” && $sticky_disable==”yes”){
if(!is_single() && !is_page() && !is_feed() && !is_sticky()) {
add_filter(‘the_content’,’auto_excerpt’);
}
} else if ($rss_disable==”yes”){
if(!is_single() && !is_page() && !is_feed()) {
add_filter(‘the_content’,’auto_excerpt’);
}
} else if ($sticky_disable==”yes”) {
if(!is_single() && !is_page() && !is_sticky()) {
add_filter(‘the_content’,’auto_excerpt’);
}
} else if ($sticky_disable!=”yes” && $rss_disable!=”yes”) {
if(!is_single() && !is_page()) {
//add_filter(‘the_excerpt_rss’,’auto_excerpt’);
add_filter(‘the_content’,’auto_excerpt’);
}
}
if (!get_option(“excerpt_everywhere_length”)){
update_option(“excerpt_everywhere_length”,”500″);
}
if (!get_option(“excerpt_everywhere_align”)){
update_option(“excerpt_everywhere_align”,”alignleft”);
}
if (!get_option(“excerpt_everywhere_rss”)){
update_option(“excerpt_everywhere_rss”,”yes”);
}
if (!get_option(“excerpt_everywhere_thumb”)){
update_option(“excerpt_everywhere_thumb”,”none”);
}
}function auto_excerpt_everywhere_options() {
add_options_page(‘Auto Excerpt Everywhere’, ‘Auto Excerpt Everywhere’, ‘manage_options’,’auto-excerpt-everywhere/options.php’);
}function myTruncate($string, $limit, $break=”.”, $pad=”…”) {
if(strlen($string) <= $limit) return $string;
if(false !== ($breakpoint = strpos($string, $break, $limit))) {
if($breakpoint < strlen($string) – 1) {
$string = substr($string, 0, $breakpoint) . $pad;
}
} return $string;
}function auto_excerpt($content) {
global $post;
$testomore = get_option(“excerpt_everywhere_moretext”);
$whatthumb = get_option(“excerpt_everywhere_thumb”);
$customclass = get_option(“excerpt_everywhere_class”);
$alignment=get_option(“excerpt_everywhere_align”); if ($alignment==”none”){$alignment=””;}
if ($whatthumb==”none”){ $thumb = “”; }
else {
if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
$default_attr = array(
‘class’ => “attachment-“.$whatthumb.” “.$alignment.” autoexcerpt_thumb “.$customclass,
‘alt’ => trim(strip_tags(strip_shortcodes( $attachment->post_excerpt ))),
‘title’ => trim(strip_tags(strip_shortcodes( $attachment->post_title ))),
);
$thumb=get_the_post_thumbnail($post->ID, $whatthumb,$default_attr);
}
}
if ($post->post_excerpt!=””){
$excerpt=$thumb.$post->post_excerpt;
if ($testomore!=””){$linkmore = ‘ ‘.$testomore.’‘;}
} else {
if (strlen($post->post_content)>get_option(“excerpt_everywhere_length”)){
$excerpt= $thumb.myTruncate(strip_tags(strip_shortcodes($post->post_content)), get_option(“excerpt_everywhere_length”), ” “, “”);
if ($testomore!=””){$linkmore = ‘ ‘.$testomore.’‘;}
} else {
$excerpt=$thumb.$content;
$linkmore=””;
}
}return $excerpt.$linkmore;
}
function custom_excerpt_everywhere_length() {
return get_option(“excerpt_everywhere_length”);
}function add_settings_link($links, $file) {
static $this_plugin;
if (!$this_plugin) $this_plugin = plugin_basename(__FILE__);if ($file == $this_plugin){
$settings_link = ‘‘.__(“Settings”, “auto-excerpt-everywhere”).’‘;
array_unshift($links, $settings_link);
}
return $links;
}register_activation_hook(__FILE__,’auto_excerpt_everywhere_activation’);
add_action(‘the_post’, ‘auto_excerpt_everywhere_construct’);
add_action(‘admin_menu’,’auto_excerpt_everywhere_options’);
add_filter(‘excerpt_length’, ‘custom_excerpt_everywhere_length’);
add_filter(‘plugin_action_links’, ‘add_settings_link’, 10, 2 );
if ( function_exists( ‘add_theme_support’ ) ) {
add_theme_support( ‘post-thumbnails’ );
}?>//
Hello,
I see you are not using my plugin, have you tried asking on their support forum? Anyway, I’ve checked that code and maybe you could try this, replace the function auto_excerpt_everywhere_construct() by the one I pasted below and see if that does the trick, if not try asking the plugin developer to see if he can give you a better solution:
function auto_excerpt_everywhere_construct() { if( !is_home_page() && !is_home() ) { $rss_disable=get_option("excerpt_everywhere_rss"); $sticky_disable=get_option("excerpt_everywhere_sticky"); if ($rss_disable=="yes" && $sticky_disable=="yes"){ if(!is_single() && !is_page() && !is_feed() && !is_sticky()) { add_filter('the_content','auto_excerpt'); } } else if ($rss_disable=="yes"){ if(!is_single() && !is_page() && !is_feed()) { add_filter('the_content','auto_excerpt'); } } else if ($sticky_disable=="yes") { if(!is_single() && !is_page() && !is_sticky()) { add_filter('the_content','auto_excerpt'); } } else if ($sticky_disable!="yes" && $rss_disable!="yes") { if(!is_single() && !is_page()) { //add_filter('the_excerpt_rss','auto_excerpt'); add_filter('the_content','auto_excerpt'); } } if (!get_option("excerpt_everywhere_length")){ update_option("excerpt_everywhere_length","500"); } if (!get_option("excerpt_everywhere_align")){ update_option("excerpt_everywhere_align","alignleft"); } if (!get_option("excerpt_everywhere_rss")){ update_option("excerpt_everywhere_rss","yes"); } if (!get_option("excerpt_everywhere_thumb")){ update_option("excerpt_everywhere_thumb","none"); } } }
Cheers.
Thanks let me try this first but which is your excerpt plug-in?
Jose,
Unfortunately, it the new function code did not work, generated a blank page.
Thanks for trying.
This is the support forum for Network Latest Posts. That’s why I couldn’t understand your question the first time :D.
- The topic ‘[Plugin: Network Latest Posts] Auto Excerpt Everywhere plug-in (exclude pages) ???’ is closed to new replies.