Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function catcheverest_homepage_featured_content() {
- //delete_transient( 'catcheverest_homepage_featured_content' );
- // Getting data from Theme Options
- global $catcheverest_options_settings;
- $options = $catcheverest_options_settings;
- $disable_homepage_featured = $options['disable_homepage_featured'];
- $quantity = $options['homepage_featured_qty'];
- $headline = $options['homepage_featured_headline'];
- $layouts = $options['homepage_featured_layout'];
- if ( $disable_homepage_featured == "0" ) {
- if ( !$catcheverest_homepage_featured_content = get_transient( 'catcheverest_homepage_featured_content' ) && ( !empty( $options['homepage_featured_image'] ) || !empty( $options['homepage_featured_title'] ) || !empty( $options['homepage_featured_content'] ) ) ) {
- echo '<!-- refreshing cache -->';
- //Checking Layout
- if ( 'four-columns' == $layouts ) {
- $parentclasses = "layout-four";
- }
- else {
- $parentclasses = "layout-three";
- }
- $catcheverest_homepage_featured_content = '<section id="featured-post" class="' . $parentclasses . '">';
- if ( !empty( $headline ) ) {
- $catcheverest_homepage_featured_content .= '<h2 id="feature-heading" class="entry-title">' . wp_kses_post( $headline ) . '</h2>';
- }
- $catcheverest_homepage_featured_content .= '<div class="featued-content-wrap">';
- for ( $i = 1; $i <= $quantity; $i++ ) {
- //Adding in Classes for Display blok and none
- if ( 'four-columns' == $layouts ) {
- if ( $i % 4 == 1 || $i == 1 ) {
- $classes = "post hentry first";
- }
- else {
- $classes = "post hentry";
- }
- }
- elseif ( $i % 3 == 1 || $i == 1 ) {
- $classes = "post hentry first";
- }
- else {
- $classes = "post hentry";
- }
- //Checking Title
- if ( !empty ( $options['homepage_featured_title'][ $i ] ) ) {
- $title = $options['homepage_featured_title'][ $i ];
- } else {
- $title = '';
- }
- //Checking Link
- if ( !empty ( $options['homepage_featured_url'][ $i ] ) ) {
- //support qTranslate plugin
- if ( function_exists( 'qtrans_convertURL' ) ) {
- $link = qtrans_convertURL($options['homepage_featured_url'][ $i ]);
- }
- else {
- $link = $options['homepage_featured_url'][ $i ];
- }
- if ( !empty ( $options['homepage_featured_base'][ $i ] ) ) {
- $target = '_blank';
- } else {
- $target = '_self';
- }
- $linkopen = '<a title="' . esc_attr( $title ) . '" href="' . esc_url( $link ) . '" target="' . $target . '">';
- $linkclose = '</a>';
- } else {
- $link = '';
- $target = '';
- $linkopen = '';
- $linkclose = '';
- }
- if ( !empty ( $options['homepage_featured_title'][ $i ] ) || !empty ( $options['homepage_featured_content'][ $i ] ) || !empty ( $options['homepage_featured_image'][ $i ] ) ) {
- $catcheverest_homepage_featured_content .= '
- <article id="featured-post-'.$i.'" class="'.$classes.'">';
- if ( !empty ( $options['homepage_featured_image'][ $i ] ) ) {
- $catcheverest_homepage_featured_content .= '
- <figure class="featured-homepage-image">
- ' . $linkopen . '
- <img src="'.$options['homepage_featured_image'][ $i ].'" class="wp-post-image" alt="' . esc_attr( $title ) . '" title="' . esc_attr( $title ) . '">
- ' . $linkclose . '
- </figure>';
- }
- if ( !empty ( $options['homepage_featured_title'][ $i ] ) || !empty ( $options['homepage_featured_content'][ $i ] ) ) {
- $catcheverest_homepage_featured_content .= '
- <div class="entry-container">';
- if ( !empty ( $options['homepage_featured_title'][ $i ] ) ) {
- $catcheverest_homepage_featured_content .= '
- <header class="entry-header">
- <h2 class="entry-title">
- ' . $linkopen . $title . $linkclose . '
- </h2>
- ' . catcheverest_featured_meta($options['homepage_featured_author'][ $i ]) . '
- </header>';
- }
- if ( !empty ( $options['homepage_featured_content'][ $i ] ) ) {
- $catcheverest_homepage_featured_content .= '
- <div class="entry-content">
- ' . $options['homepage_featured_content'][ $i ] . $linkopen . ' Read more...' . $linkclose. '
- </div>';
- }
- $catcheverest_homepage_featured_content .= '
- </div><!-- .entry-container -->';
- }
- $catcheverest_homepage_featured_content .= '
- </article><!-- .slides -->';
- }
- }
- $catcheverest_homepage_featured_content .= '</div><!-- .featued-content-wrap -->';
- $catcheverest_homepage_featured_content .= '</section><!-- #featured-post -->';
- }
- echo $catcheverest_homepage_featured_content;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment