= 2 || $page >= 2 ) {
$filtered_title .= ' | ' . sprintf( __( 'Page %s', 'simplecatch' ), max( $paged, $page ) );
}
// Return the modified title
return $filtered_title;
}
add_filter( 'wp_title', 'simplecatch_filter_wp_title' );
/**
* Sets the post excerpt length to 30 words.
*
* function tied to the excerpt_length filter hook.
* @uses filter excerpt_length
*/
function simplecatch_excerpt_length( $length ) {
return 30;
}
add_filter( 'excerpt_length', 'simplecatch_excerpt_length' );
/**
* Returns a "Continue Reading" link for excerpts
*/
function simplecatch_continue_reading() {
$options = get_option( 'simplecatch_options' );
if( !isset( $options[ 'more_tag_text' ] ) ) {
$options[ 'more_tag_text' ] = "Continue Reading →";
}
$more_tag_text = $options[ 'more_tag_text' ];
return ' ' . sprintf( __( '%s', 'simplecatch' ), esc_attr( $more_tag_text ) ) . ' ';
}
/**
* Replaces "[...]" (appended to automatically generated excerpts) with simplecatch_continue_reading().
*
*/
function simplecatch_excerpt_more( $more ) {
return ' …' . simplecatch_continue_reading();
}
add_filter( 'excerpt_more', 'simplecatch_excerpt_more' );
/**
* Adds Continue Reading link to post excerpts.
*
* function tied to the get_the_excerpt filter hook.
*/
function simplecatch_custom_excerpt( $output ) {
if ( has_excerpt() && ! is_attachment() ) {
$output .= simplecatch_continue_reading();
}
return $output;
}
add_filter( 'get_the_excerpt', 'simplecatch_custom_excerpt' );
/**
* Allows post queries to sort the results by the order specified in the post__in parameter.
* Just set the orderby parameter to post__in
*
* uses action filter posts_orderby
*/
if ( !function_exists('simplecatch_sort_query_by_post_in') ) : //simple WordPress 3.0+ version, now across VIP
add_filter('posts_orderby', 'simplecatch_sort_query_by_post_in', 10, 2);
function simplecatch_sort_query_by_post_in($sortby, $thequery) {
if ( isset($thequery->query['post__in']) && !empty($thequery->query['post__in']) && isset($thequery->query['orderby']) && $thequery->query['orderby'] == 'post__in' )
$sortby = "find_in_set(ID, '" . implode( ',', $thequery->query['post__in'] ) . "')";
return $sortby;
}
endif;
/**
* Get the header logo Image from theme options
*
* @uses header logo
* @get the data value of image from theme options
* @display Header Image logo
*
* @uses default logo if logo field on theme options is empty
*
* @uses set_transient and delete_transient
*/
function simplecatch_headerdetails() {
//delete_transient( 'simplecatch_headerdetails' );
// get data value from simplecatch_options through theme options
$options = get_option( 'simplecatch_options' );
if ( ( !$simplecatch_headerdetails = get_transient( 'simplecatch_headerdetails' ) ) && ( empty( $options[ 'remove_header_logo' ] ) || empty( $options[ 'remove_site_title' ] ) || empty( $options[ 'remove_site_description' ] ) ) ) {
echo '';
$simplecatch_headerdetails = '
';
if( empty( $options[ 'remove_header_logo' ] ) || empty( $options[ 'remove_site_title' ] ) ) {
$simplecatch_headerdetails .= '
';
}
if( empty( $options[ 'remove_site_description' ] ) ) {
$simplecatch_headerdetails .= '
'.get_bloginfo( 'description' ).' ';
}
$simplecatch_headerdetails .= '
';
set_transient( 'simplecatch_headerdetails', $simplecatch_headerdetails, 86940 );
}
echo $simplecatch_headerdetails;
} // simplecatch_headerdetails
/**
* Get the footer logo Image from theme options
*
* @uses footer logo
* @get the data value of image from theme options
* @display footer Image logo
*
* @uses default logo if logo field on theme options is empty
*
* @uses set_transient and delete_transient
*/
function simplecatch_footerlogo() {
//delete_transient('simplecatch_footerlogo');
if ( !$simplecatch_footerlogo = get_transient( 'simplecatch_footerlogo' ) ) {
// get data value from catch_options through theme options
$options = get_option( 'simplecatch_options' );
if( !isset( $options[ 'remove_footer_logo' ] ) ) {
$options[ 'remove_footer_logo' ] = "0";
}
echo '';
if ( $options[ 'remove_footer_logo' ] == "0" ) :
// if not empty featured_logo_footer on theme options
if ( !empty( $options[ 'featured_logo_footer' ] ) ) :
$simplecatch_footerlogo =
' ';
else:
// if empty featured_logo_footer on theme options, display default fav icon
$simplecatch_footerlogo ='
';
endif;
endif;
set_transient( 'simplecatch_footerlogo', $simplecatch_footerlogo, 86940 );
}
echo $simplecatch_footerlogo;
} // simplecatch_footerlogo
/**
* Get the favicon Image from theme options
*
* @uses favicon
* @get the data value of image from theme options
* @display favicon
*
* @uses default favicon if favicon field on theme options is empty
*
* @uses set_transient and delete_transient
*/
function simplecatch_favicon() {
//delete_transient( 'simplecatch_favicon' );
if( ( !$simplecatch_favicon = get_transient( 'simplecatch_favicon' ) ) ) {
// get data value from simplecatch_options through theme options
$options = get_option( 'simplecatch_options' );
if( !isset( $options[ 'remove_favicon' ] ) ) {
$options[ 'remove_favicon' ] = "0";
}
echo '';
if ( $options[ 'remove_favicon' ] == "0" ) :
// if not empty fav_icon on theme options
if ( !empty( $options[ 'fav_icon' ] ) ) :
$simplecatch_favicon = ' ';
else:
// if empty fav_icon on theme options, display default fav icon
$simplecatch_favicon = ' ';
endif;
endif;
set_transient( 'simplecatch_favicon', $simplecatch_favicon, 86940 );
}
echo $simplecatch_favicon ;
} // simplecatch_favicon
//Load Favicon in Header Section
add_action('wp_head', 'simplecatch_favicon');
//Load Favicon in Admin Section
add_action( 'admin_head', 'simplecatch_favicon' );
/**
* This function to display featured posts on homepage header
*
* @get the data value from theme options
* @displays on the homepage header
*
* @useage Featured Image, Title and Content of Post
*
* @uses set_transient and delete_transient
*/
function simplecatch_sliders() {
global $post;
//delete_transient( 'simplecatch_sliders' );
// get data value from simplecatch_options through theme options
$options = get_option( 'simplecatch_options' );
// get slider_qty from theme options
if( isset( $options[ 'slider_qty' ] ) ) {
$postperpage = $options[ 'slider_qty' ];
}
if( ( !$simplecatch_sliders = get_transient( 'simplecatch_sliders' ) ) && !empty( $options[ 'featured_slider' ] ) ) {
echo '';
$simplecatch_sliders = '
';
$get_featured_posts = new WP_Query( array(
'posts_per_page' => $postperpage,
'post__in' => $options[ 'featured_slider' ],
'orderby' => 'post__in',
'ignore_sticky_posts' => 1 // ignore sticky posts
));
while ( $get_featured_posts->have_posts()) : $get_featured_posts->the_post();
$title_attribute = apply_filters( 'the_title', get_the_title( $post->ID ) );
$excerpt = get_the_excerpt();
$simplecatch_sliders .= '
';
if( $excerpt !='') {
$simplecatch_sliders .= the_title( '',' ', false ).': '.$excerpt;
}
$simplecatch_sliders .= '
';
endwhile; wp_reset_query();
$simplecatch_sliders .= '
';
set_transient( 'simplecatch_sliders', $simplecatch_sliders, 86940 );
}
echo $simplecatch_sliders;
} // simplecatch_sliders
/**
* Display slider or breadcrumb on header
*
* If the page is home or front page, slider is displayed.
* In other pages, breadcrumb will display if exist bread
*/
function simplecatch_sliderbreadcrumb() {
// If the page is home or front page
if ( is_home() || is_front_page() ) :
// display featured slider
if ( function_exists( 'simplecatch_sliders' ) ):
simplecatch_sliders();
endif;
else :
// if breadcrumb is not empty, display breadcrumb
if ( function_exists( 'bcn_display_list' ) ):
echo '
';
bcn_display_list();
echo '
';
endif;
endif;
} // simplecatch_sliderbreadcrumb
/**
* This function for social links display on header
*
* @fetch links through Theme Options
* @use in widget
* @social links, Facebook, Twitter and RSS
*/
function simplecatch_headersocialnetworks() {
//delete_transient( 'simplecatch_headersocialnetworks' );
// get the data value from theme options
$options = get_option( 'simplecatch_options' );
if ( ( !$simplecatch_headersocialnetworks = get_transient( 'simplecatch_headersocialnetworks' ) ) && ( !empty( $options[ 'social_facebook' ] ) || !empty( $options[ 'social_twitter' ] ) || !empty( $options[ 'social_googleplus' ] ) || !empty( $options[ 'social_pinterest' ] ) || !empty( $options[ 'social_youtube' ] ) || !empty( $options[ 'social_linkedin' ] ) || !empty( $options[ 'social_slideshare' ] ) || !empty( $options[ 'social_foursquare' ] ) || !empty( $options[ 'social_rss' ] ) || !empty( $options[ 'social_vimeo' ] ) || !empty( $options[ 'social_flickr' ] ) || !empty( $options[ 'social_tumblr' ] ) || !empty( $options[ 'social_deviantart' ] ) || !empty( $options[ 'social_dribbble' ] ) || !empty( $options[ 'social_myspace' ] ) || !empty( $options[ 'social_wordpress' ] ) || !empty( $options[ 'social_delicious' ] ) || !empty( $options[ 'social_lastfm' ] ) ) ) {
echo '';
$simplecatch_headersocialnetworks .='
';
set_transient( 'simplecatch_headersocialnetworks', $simplecatch_headersocialnetworks, 86940 );
}
echo $simplecatch_headersocialnetworks;
} // simplecatch_headersocialnetworks
/**
* Site Verification and Webmaster Tools
*
* If user sets the code we're going to display meta verification
* @get the data value from theme options
* @uses wp_head action to add the code in the header
* @uses set_transient and delete_transient API for cache
*/
function simplecatch_site_verification() {
//delete_transient( 'simplecatch_site_verification' );
if ( ( !$simplecatch_site_verification = get_transient( 'simplecatch_site_verification' ) ) ) {
// get the data value from theme options
$options = get_option( 'simplecatch_options' );
echo '';
//google
if ( !empty( $options['google_verification'] ) ) {
$simplecatch_site_verification .= ' ' . "\n";
}
//bing
if ( !empty( $options['bing_verification'] ) ) {
$simplecatch_site_verification .= ' ' . "\n";
}
//yahoo
if ( !empty( $options['yahoo_verification'] ) ) {
$simplecatch_site_verification .= ' ' . "\n";
}
//site stats, analytics header code
if ( !empty( $options['analytic_header'] ) ) {
$simplecatch_site_verification .= $options[ 'analytic_header' ] ;
}
}
echo $simplecatch_site_verification;
}
add_action('wp_head', 'simplecatch_site_verification');
/**
* This function loads the Footer Code such as Add this code from the Theme Option
*
* @get the data value from theme options
* @load on the footer ONLY
* @uses wp_footer action to add the code in the footer
* @uses set_transient and delete_transient
*/
function simplecatch_footercode() {
//delete_transient( 'simplecatch_footercode' );
if ( ( !$simplecatch_footercode = get_transient( 'simplecatch_footercode' ) ) ) {
// get the data value from theme options
$options = get_option( 'simplecatch_options' );
echo '';
//site stats, analytics header code
if ( !empty( $options['analytic_footer'] ) ) {
$simplecatch_footercode = $options[ 'analytic_footer' ] ;
}
set_transient( 'simplecatch_footercode', $simplecatch_footercode, 86940 );
}
echo $simplecatch_footercode;
}
add_action('wp_footer', 'simplecatch_footercode');
/**
* Hooks the Custom Inline CSS to head section
*
* @since Simple Catch 1.2.3
*/
function simplecatch_inline_css() {
//delete_transient( 'simplecatch_inline_css' );
if ( ( !$simplecatch_inline_css = get_transient( 'simplecatch_inline_css' ) ) ) {
// get the data value from theme options
$options = get_option( 'simplecatch_options' );
echo '' . "\n";
if( !empty( $options[ 'custom_css' ] ) ) {
$simplecatch_inline_css = '' . "\n";
$simplecatch_inline_css .= '' . "\n";
}
set_transient( 'simplecatch_inline_css', $simplecatch_inline_css, 86940 );
}
echo $simplecatch_inline_css;
}
add_action('wp_head', 'simplecatch_inline_css');
/*
* Function for showing custom tag cloud
*/
function simplecatch_custom_tag_cloud() {
?>
$transition_effect,
'transition_delay' => $transition_delay,
'transition_duration' => $transition_duration
)
);
}// simplecatch_pass_slider_value
/**
* Alter the query for the main loop in home page
* @uses pre_get_posts hook
*/
function simple_catch_alter_home( $query ){
$options = get_option( 'simplecatch_options' );
if( !isset( $options[ 'exclude_slider_post' ] ) ) {
$options[ 'exclude_slider_post' ] = "0";
}
if ( $options[ 'exclude_slider_post'] != "0" && !empty( $options[ 'featured_slider' ] ) ) {
if( $query->is_main_query() && $query->is_home() ) {
$query->query_vars['post__not_in'] = $options[ 'featured_slider' ];
}
}
if ( !empty( $options[ 'front_page_category' ] ) ) {
if( $query->is_main_query() && $query->is_home() ) {
$query->query_vars['category__in'] = $options[ 'front_page_category' ];
}
}
}
add_action( 'pre_get_posts','simple_catch_alter_home' );
/**
* function that displays frquently asked question in theme option
*/
function simplecatch_faq() {
?>
FAQ: Frequently Asked Questions
1. How to change logo on Header and Footer?
Click on Theme Options under Appearance.
Select the Logo Tab. You can see the default logo previews.
Now click on Change Header Logo and Footer Logo button.
Browse the Logo image from desired location and insert into the Post.
Click on Save button. Now you can see the previews.
2. How to change fav icon?
Click on Theme Options under Appearance.
Select the Fav Icon Tab. You can see the default fav icon preview.
Now click on Change Fav Icon button.
Browse the fav icon image from desired location and insert into the Post.
Click on Save button. Now you can see the preview.
3. How to insert Social links on the right side of header?
Click on Theme Options under Appearance.
Select the Social Links Tab.
Here you can see different social links like facebook, twitter etc.
Give the social links on its respective socal fields. For example http://www.facebook.com. for facebook etc.
Click on Save button.
4. How to insert Analytic scripts?
Click on Theme Options under Appearance.
Select the Analytic Option Tab.
Here you can put different scripts like, google, facebook etc.
Put the script on upper textarea which you want to load on header.
Put the script on lower textarea which you want to load on footer.
Click on Save button.
5. How to choose featured slider?
Click on Featured Slider under Appearance.
Give the No. of slides and click on Save Button.
Now there is list of the Featured Col #1, #2 etc.
To Give the Post ID's, click on "Click Here to Edit" Button which redirect you into the edit posts.
Now find the post ID's which you want to display and keep that ID's on blank Featured Col #1.....
Click on Save button.
6. How to create pagination in single post if the post is too long?
Click on the Post.
Edit the specific post which you want to breakdown into more pages.
Now Keep the cursor to the exact place of post where you like to break.
Then copy this shortcode and paste it.
You can repeat this shortcode many times where you wan to break down.
Update the post.
Click on Save button.