Advertisement
catchmahesh

Remove link from title in Featured Content: Catch Base Pro

May 17th, 2016
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.34 KB | None | 0 0
  1. function catchbase_page_content( $options ) {
  2.     global $post;
  3.  
  4.     $quantity                   = $options [ 'featured_content_number' ];
  5.  
  6.     $more_link_text             = $options['excerpt_more_text'];
  7.    
  8.     $show_content               = isset( $options['featured_content_show'] ) ? $options['featured_content_show'] : 'excerpt';
  9.  
  10.     $catchbase_page_content     = '';
  11.  
  12.     $number_of_page             = 0;        // for number of pages
  13.  
  14.     $page_list                  = array();  // list of valid pages ids
  15.  
  16.     //Get valid pages
  17.     for( $i = 1; $i <= $quantity; $i++ ){
  18.         if( isset ( $options['featured_content_page_' . $i] ) && $options['featured_content_page_' . $i] > 0 ){
  19.             $number_of_page++;
  20.  
  21.             $page_list  =   array_merge( $page_list, array( $options['featured_content_page_' . $i] ) );
  22.         }
  23.  
  24.     }
  25.     if ( !empty( $page_list ) && $number_of_page > 0 ) {
  26.         $get_featured_posts = new WP_Query( array(
  27.                     'posts_per_page'        => $number_of_page,
  28.                     'post__in'              => $page_list,
  29.                     'orderby'               => 'post__in',
  30.                     'post_type'             => 'page',
  31.                 ));
  32.  
  33.         $i=0;
  34.         while ( $get_featured_posts->have_posts()) : $get_featured_posts->the_post(); $i++;
  35.             $title_attribute = the_title_attribute( array( 'before' => __( 'Permalink to:', 'catch-base' ), 'echo' => false ) );
  36.            
  37.             $excerpt = get_the_excerpt();
  38.            
  39.             $catchbase_page_content .= '
  40.                 <article id="featured-post-' . $i . '" class="post hentry featured-page-content">';
  41.                 if ( has_post_thumbnail() ) {
  42.                     $catchbase_page_content .= '
  43.                     <figure class="featured-homepage-image">
  44.                         <a href="' . get_permalink() . '" title="' . the_title_attribute( array( 'before' => __( 'Permalink to:', 'catch-base' ), 'echo' => false ) ) . '">
  45.                         '. get_the_post_thumbnail( $post->ID, 'medium', array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $title_attribute ), 'class' => 'pngfix' ) ) .'
  46.                         </a>
  47.                     </figure>';
  48.                 }
  49.                 else {
  50.                     $catchbase_first_image = catchbase_get_first_image( $post->ID, 'medium', array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $title_attribute ), 'class' => 'pngfix' ) );
  51.  
  52.                     if ( '' != $catchbase_first_image ) {
  53.                         $catchbase_page_content .= '
  54.                         <figure class="featured-homepage-image">
  55.                             <a href="' . get_permalink() . '" title="' . the_title_attribute( array( 'before' => __( 'Permalink to:', 'catch-base' ), 'echo' => false ) ) . '">
  56.                                 '. $catchbase_first_image .'
  57.                             </a>
  58.                         </figure>';
  59.                     }
  60.                 }
  61.  
  62.                 $catchbase_page_content .= '
  63.                     <div class="entry-container">
  64.                         <header class="entry-header">
  65.                             <h1 class="entry-title">
  66.                                 ' . the_title( '','', false ) . '
  67.                             </h1>
  68.                         </header>';
  69.                         if ( 'excerpt' == $show_content ) {
  70.                             $catchbase_page_content .= '<div class="entry-excerpt"><p>' . $excerpt . '</p></div><!-- .entry-excerpt -->';
  71.                         }
  72.                         elseif ( 'full-content' == $show_content ) {
  73.                             $content = apply_filters( 'the_content', get_the_content() );
  74.                             $content = str_replace( ']]>', ']]&gt;', $content );
  75.                             $catchbase_page_content .= '<div class="entry-content">' . $content . '</div><!-- .entry-content -->';
  76.                         }
  77.                     $catchbase_page_content .= '
  78.                     </div><!-- .entry-container -->
  79.                 </article><!-- .featured-post-'. $i .' -->';
  80.         endwhile;
  81.  
  82.         wp_reset_query();
  83.     }      
  84.    
  85.     return $catchbase_page_content;
  86. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement