';
$str_after = '';
if ( ( is_singular() ) || ( is_home() ) || ( is_archive() ) ) {
return $str_before . $content . $str_after;
} else {
return $content;
}
} else {
return $content;
}
}
add_filter( 'the_content', 'ata_content_nofilter' );
/**
* Function to modify the_content filter priority.
*
*/
function ata_content_prepare_filter() {
global $ata_settings;
$priority = isset ( $ata_settings['content_filter_priority'] ) ? $ata_settings['content_filter_priority'] : 10;
add_filter( 'the_content', 'ata_content', $priority );
}
add_action( 'template_redirect', 'ata_content_prepare_filter' );
/**
* Function to add custom HTML before and after the post content. Filters `the_content`.
*
* @param string $content Post content
* @return string Filtered post content
*/
function ata_content( $content ) {
global $ata_settings;
if ( ( is_singular() ) || ( is_home() ) || ( is_archive() ) ) {
$str_before = '';
$str_after = '';
if ( is_singular() ) {
if ( $ata_settings['content_addhtmlbefore'] ) {
$str_before .= stripslashes( $ata_settings['content_htmlbefore'] );
}
if ( $ata_settings['content_addhtmlafter'] ) {
$str_after .= stripslashes( $ata_settings['content_htmlafter'] );
}
if ( $ata_settings['content_addhtmlbeforeS'] ) {
$str_before .= stripslashes( $ata_settings['content_htmlbeforeS'] );
}
if ( $ata_settings['content_addhtmlafterS'] ) {
$str_after .= stripslashes( $ata_settings['content_htmlafterS'] );
}
} elseif ( ( is_home() ) || ( is_archive() ) ) {
if ( $ata_settings['content_addhtmlbefore'] ) {
$str_before .= stripslashes( $ata_settings['content_htmlbefore'] );
}
if ( $ata_settings['content_addhtmlafter'] ) {
$str_after .= stripslashes( $ata_settings['content_htmlafter'] );
}
}
return $str_before . $content . $str_after;
} else {
return $content;
}
}
/**
* Function to add content to RSS feeds. Filters `the_excerpt_rss` and `the_content_feed`.
*
* @param string $content Post content
* @return string Filtered post content
*/
function ald_ata_rss( $content ) {
global $ata_settings;
if ( ( $ata_settings[ 'feed_addhtmlbefore' ] ) || ( $ata_settings[ 'feed_addhtmlafter' ] ) || ( $ata_settings[ 'feed_addtitle' ] ) || ( $ata_settings[ 'feed_addcopyright' ] ) || ( $ata_settings[ 'addcredit' ] ) ) {
$str_before = '';
$str_after = '
';
if ( $ata_settings[ 'feed_addhtmlbefore' ] ) {
$str_before .= stripslashes( $ata_settings[ 'feed_htmlbefore' ] );
$str_before .= '
';
}
if ( $ata_settings[ 'feed_addhtmlafter' ] ) {
$str_after .= stripslashes( $ata_settings[ 'feed_htmlafter' ] );
$str_after .= '
';
}
if ( $ata_settings[ 'feed_addtitle' ] ) {
$title = '' . the_title( '', '', false ) . '';
$search_array = array(
'%title%',
'%date%',
'%time%',
);
$replace_array = array(
$title,
get_the_time( 'F j, Y' ),
get_the_time( 'g:i a' ),
);
$str_after .= str_replace( $search_array, $replace_array, $ata_settings['feed_titletext'] );
$str_after .= '
';
}
if ( $ata_settings[ 'feed_addcopyright' ] ) {
$str_after .= stripslashes( $ata_settings[ 'feed_copyrightnotice' ] );
$str_after .= '
';
}
if ( $ata_settings[ 'addcredit' ] ) {
$creditline = '
';
$creditline .= __( 'Feed enhanced by ', 'add-to-all' );
$creditline .= 'Add To All';
$str_after .= $creditline;
$str_after .= '
';
}
return $str_before . $content . $str_after;
} else {
return $content;
}
}
add_filter( 'the_excerpt_rss', 'ald_ata_rss', 99999999 );
add_filter( 'the_content_feed', 'ald_ata_rss', 99999999 );
/**
* Function to add custom code to the header. Filters `wp_head`.
*
*/
function ald_ata_header() {
global $wpdb, $post, $single, $ata_settings;
$ata_other = stripslashes( $ata_settings[ 'head_other' ] );
$ata_head_CSS = stripslashes( $ata_settings[ 'head_CSS' ] );
$ata_tp_tynt_id = stripslashes( $ata_settings[ 'tp_tynt_id' ] );
// Add CSS to header
if ( $ata_head_CSS != '' ) {
echo '';
}
// Add Tynt code to Header
if ( $ata_tp_tynt_id != '' ) {
?>
' . get_option( 'blogname' ) . '". ';
$copyrightnotice .= __( 'Use of this feed is for personal non-commercial use only. If you are not reading this article in your feed reader, then the site is guilty of copyright infringement. Please contact me at ', 'ald_ata_plugin' );
$copyrightnotice .= get_option( 'admin_email' );
$ga_url = parse_url( get_option( 'home' ), PHP_URL_HOST );
$titletext = __( '%title% was first posted on %date% at %time%.', 'add-to-all' );
$ata_settings = array(
'addcredit' => false, // Show credits?
// Content options
'content_htmlbefore' => '', // HTML you want added to the content
'content_htmlafter' => '', // HTML you want added to the content
'content_addhtmlbefore' => false, // Add HTML to content?
'content_addhtmlafter' => false, // Add HTML to content?
'content_htmlbeforeS' => '', // HTML you want added to the content on single pages only
'content_htmlafterS' => '', // HTML you want added to the content on single pages only
'content_addhtmlbeforeS' => false, // Add HTML to content on single pages?
'content_addhtmlafterS' => false, // Add HTML to content on single pages?
'content_filter_priority' => 999, // Content priority
// Feed options
'feed_htmlbefore' => '', // HTML you want added to the feed
'feed_htmlafter' => '', // HTML you want added to the feed
'feed_copyrightnotice' => $copyrightnotice, // Copyright Notice
'feed_emailaddress' => get_option( 'admin_email' ), // Admin Email
'feed_addhtmlbefore' => false, // Add HTML to Feed?
'feed_addhtmlafter' => false, // Add HTML to Feed?
'feed_addtitle' => true, // Add title of the post?
'feed_titletext' => $titletext, // Custom text when adding a link to the post title
'feed_addcopyright' => true, // Add copyright notice?
// 3rd party options
'tp_sc_project' => '', // StatCounter Project ID
'tp_sc_security' => '', // StatCounter Security String
'tp_ga_uacct' => '', // Google Analytics Web Property ID
'tp_ga_domain' => $ga_url, // Google Analytics _setDomainName value
'tp_ga_ua' => false, // Use Google Universal Analytics code
'tp_kontera_ID' => '', // Kontera Publisher ID
'tp_kontera_linkcolor' => '', // Kontera link color
'tp_kontera_addZT' => '', // Kontera Add zone tags
'tp_tynt_id' => '', // Tynt ID
// Footer options
'ft_other' => '', // For any other code
// Header options
'head_CSS' => '', // CSS to add to header (do not wrap with