badget

Biggest Sale! Special Offer!

Get 30% discount on all of our single themes with this coupon code: #30%SALE

Hurry up! *Limited time offer*

BLOG Medium – Custom Post Category

Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #25378
    aris
    Participant

    Apparently it is possible to create a Page (frontpage) which can show ONLY a specific category of posts in Blog Medium template.

    What if i need to crate a simple page and connect the Blog medium template?! Is it possible to show only a specific post category? If Yes, how? If not, is there any workaround.. An other solution you can put us on the right way?

    #25413

    hi aris,

    If you use blog medium template then this feature is not available in our theme. If you use the default post then you can only display the specific category of posts only in front page not in other page. We have designed our theme this way. To display category post in blog medium template then it needs code customization and you need to hire a developer to fix it.

    Thank you!

    #25417
    aris
    Participant

    Hi there,

    Ok lets look the problem from a different point of view!

    I’ve found a way to “cheat” the system so it shows only posts from a specific category (no code customization no nothing). However it seems that Blog Image Large template is the default template because all my posts from this specific category are showing in the same way as this template

    Look my site: http://www.artech-it.com/category/education/
    Your site (Blog Image Large): https://www.themehorse.com/preview/ultimate-pro/blog-image-large/

    So i think there must be a way to change the default blog template…

    So my question would be: How can i define the BLOG IMAGE MEDIUM as a default Template for all my posts 🙂

    Thanks in advance

    #25463

    Hi aris,

    Yes you can make it default but you have to customize the code. Before making any changes in the code first of all you need to create a child theme and then only customize the code so that your updated version will not lose the code.

    You go to the theme folder -> inc -> structure -> content-extension.php on line no 87 can you see this functions
    if ( ! function_exists( 'ultimate_theloop_for_archive' ) ) :

    If yes then can you see this line no 134 to 143, you will find this code.

        <?php
    			if( has_post_thumbnail() ) {
    				$image = '';        			
    	     		$title_attribute = apply_filters( 'the_title', get_the_title( $post->ID ) );
    	     		$image .= '<figure class="post-featured-image">';
    	  			$image .= '<a href="' . get_permalink() . '" title="'.the_title( '', '', false ).'">';
    	  			$image .= get_the_post_thumbnail( $post->ID, 'featured', array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $title_attribute ) ) ).'</a>';
    	  			$image .= '</figure><!-- .post-featured-image -->';
    	  			echo $image;
      		} ?>

    Replace above code and add this below code

    <?php
            if( has_post_thumbnail() ) {
              $image = '';              
                $title_attribute = apply_filters( 'the_title', get_the_title( $post->ID ) );
                $image .= '<figure class="post-featured-image">';
                $image .= '<a href="' . get_permalink() . '" title="'.the_title( '', '', false ).'">';
                $image .= get_the_post_thumbnail( $post->ID, 'featured-medium', array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $title_attribute ) ) ).'</a>';
                $image .= '</figure><!-- .post-featured-image -->';
                echo $image;
            } ?>

    and after doing this go to line no 238 and can you see this code if ( ! function_exists( ‘ultimate_theloop_for_single’ ) ) :
    if yes then goto line no 276 to 287 and replace the old code and add the below code

    <?php
            if( has_post_thumbnail() ) {
              $image = '';              
                $title_attribute = apply_filters( 'the_title', get_the_title( $post->ID ) );
                $image .= '<figure class="post-featured-image">';
                $image .= '<a href="' . get_permalink() . '" title="'.the_title( '', '', false ).'">';
                $image .= get_the_post_thumbnail( $post->ID, 'featured-medium', array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $title_attribute ) ) ).'</a>';
                $image .= '</figure><!-- .post-featured-image -->';
                echo $image;
            } ?>

    Hope this may help you

    Thank you!

    #25506
    aris
    Participant

    Hi there,

    My child theme has the following files/folders

    footer.php
    functions.php
    style.css

    i created the inc->structure folders and copied the content-extension.php file from the main theme folder in the same structure (inside structure folder of my child theme)

    i made the above changes to the file in my child theme folder and the child theme is activated. The default post template is not changing, i’m seeing the same format

    http://www.artech-it.com/category/education/

    I want it to be like yours

    https://www.themehorse.com/preview/ultimate-pro/blog-image-medium/

    #25535

    Hi aris,

    First of all you need to unhook the functions and then only customize the code. Creating the same directory folder and copying all the content will not change the code. Here is a simple example how to unhook functions and you do the same for the above code that i have added yesterday.
    This is just an example.

    //unhook functions
    
    // Unhook default Thematic functions
    function unhook_thematic_functions() {
        // Don't forget the position number if the original function has one
    
    remove_action( 'attitude_404_content', 'attitude_display_404_page_content', 10 );
    
    }
    add_action('init','unhook_thematic_functions'); // removes the header content by using hook attitude_header
    
    add_action( 'attitude_404_content', 'attitude_child_display_404_page_content', 10 );
    /**
     * function to show the footer info, copyright information
     */
     
     
    function attitude_child_display_404_page_content() {      ?>   
    <div id="content">
    		<header class="entry-header">
    			<h1 class="entry-title"><?php _e( 'Error 404-Page NOT Found', 'attitude' ); ?></h1>
    		</header>
    		<div class="entry-content clearfix" >
    			<p>Thank you</p> 
    		</div><!-- .entry-content -->
    	</div><!-- #content -->
      <?php 
    }

    All this code you must add in the functions.php file. We need only functions.php and style.css file

    Thank you!

    #25536

    Hi aris,

    First of all you need to unhook the functions and then only customize the code. Creating the same directory folder and copying all the content will not change the code. Here is a simple example how to unhook functions and you do the same for the above code that i have added yesterday.
    This is just an example.

    //unhook functions
    
    // Unhook default Thematic functions
    function unhook_thematic_functions() {
        // Don't forget the position number if the original function has one
    
    remove_action( 'attitude_404_content', 'attitude_display_404_page_content', 10 );
    
    }
    add_action('init','unhook_thematic_functions'); // removes the header content by using hook attitude_header
    
    add_action( 'attitude_404_content', 'attitude_child_display_404_page_content', 10 );
    /**
     * function to show the footer info, copyright information
     */
     
     
    function attitude_child_display_404_page_content() {      ?>   
    <div id="content">
    		<header class="entry-header">
    			<h1 class="entry-title"><?php _e( 'Error 404-Page NOT Found', 'attitude' ); ?></h1>
    		</header>
    		<div class="entry-content clearfix" >
    			<p>Thank you</p> 
    		</div><!-- .entry-content -->
    	</div><!-- #content -->
      <?php 
    }

    All this code you must add in the functions.php file.
    Thank you!

    #25565
    aris
    Participant

    Hi again,

    Could you kindly be more specific? I have already a functions.php and style.css in my child theme. I don’t know which function to unhook

    Many thanks in advance (I’m using ultimate-pro template)

    #25578

    hi aris,

    First of all unhook this functions
    add_action( 'ultimate_loop_content', 'ultimate_theloop', 10 ); with `remove_action( ‘ultimate_loop_content’, ‘ultimate_theloop’, 1
    0 );`
    After doing it add this code
    add_action(‘init’,’unhook_thematic_functions’);

    add_action( 'ultimate_loop_content', 'ultimate_loop_content_child', 10 );
    /**
     * Shows the loop content
     */
    function ultimate_loop_content_child() {
    	if( is_page() ) {
    		if( is_page_template( 'page-templates/page-template-blog-image-large.php' ) ) {
    			ultimate_theloop_for_template_blog_image_large();
    		}
    		elseif( is_page_template( 'page-templates/page-template-blog-image-medium.php' ) ) {
    			ultimate_theloop_for_template_blog_image_medium();
    		}
    		elseif( is_page_template( 'page-templates/page-template-blog-full-content.php' ) ) {
    			ultimate_theloop_for_template_blog_full_content();
    		}
        else {
        ultimate_theloop_for_page();
        }
    	}
    	elseif( is_single() ) {
    		ultimate_theloop_for_single();
    	}
    	elseif( is_search() ) {
    		ultimate_theloop_for_search();
    	}
    	else {
    		ultimate_theloop_for_archive();
    	}
    }

    After adding this content you need to copy the content from content-extension.php from line no 86 to 735 in functions.php and edit the code that i have previously added.

    Hope this may help you
    Thank you!

    #25719
    aris
    Participant

    Hi,

    I think I’m confused. I really would appreciate if you send me, step by step what should i do!

    What i need is to change ONLY default BLOG Template (not the page one). I want the BLOG-Medium-Image as a default template for all my posts (only posts, not pages).

    (if you remember, my problem was that i was not able to show posts from specific category within a page with Blog-Image-Medium template, so i just created a Post Category Menu Item which shows posts only from a specific category, however the default template for posts is Blog-Images-Large, which i don’t want).

    https://www.themehorse.com/preview/ultimate-pro/blog-image-medium/ ( for category posts listing )

    I have tried everything you told me with the below order

    1- Copied the content-extension.php to the child theme and made the changes (replaced the code you told me)
    2- Unhooked the functions in functions.php ( it remove all the pages and posts )
    3- added the code as you advised in functions.php (didn’t work)

    So if it is possible send me in one post step by step what i should do, will be a great help

    regards,

    Aris

    #25737

    Hi aris,

    We cannot provide you all step by step. For this you need to hire a developer.
    First of all create two files styles.css and functions.php file
    under functions.php file add this code
    unhook this functions
    add_action( 'ultimate_loop_content', 'ultimate_theloop', 10 ); with `remove_action( ‘ultimate_loop_content’, ‘ultimate_theloop’, 1
    0 );`

    After doing it add this code add this code

    add_action(‘init’,’unhook_thematic_functions’);
    
    add_action( 'ultimate_loop_content', 'ultimate_loop_content_child', 10 );
    /**
     * Shows the loop content
     */
    function ultimate_loop_content_child() {
    	if( is_page() ) {
    		if( is_page_template( 'page-templates/page-template-blog-image-large.php' ) ) {
    			ultimate_theloop_for_template_blog_image_large();
    		}
    		elseif( is_page_template( 'page-templates/page-template-blog-image-medium.php' ) ) {
    			ultimate_theloop_for_template_blog_image_medium();
    		}
    		elseif( is_page_template( 'page-templates/page-template-blog-full-content.php' ) ) {
    			ultimate_theloop_for_template_blog_full_content();
    		}
        else {
        ultimate_theloop_for_page();
        }
    	}
    	elseif( is_single() ) {
    		ultimate_theloop_for_single();
    	}
    	elseif( is_search() ) {
    		ultimate_theloop_for_search();
    	}
    	else {
    		ultimate_theloop_for_archive();
    	}
    }
    

    Now your child theme funtions is ready. Now go to the theme folder -> inc -> structure -> content-extension.php on line no 86 you will find this code

    /****************************************************************************************/
    if ( ! function_exists( 'ultimate_theloop_for_archive' ) ) :

    and copy from this line 86 to line no 735 where in line no 735 you will find this code.

          $wp_query = $temp_query;
          wp_reset_postdata();
    }
    endif;
    /****************************************************************************************/

    Are you still with me? Ok then you need to change the code in your functions.php file
    under this functions
    if ( ! function_exists( 'ultimate_theloop_for_archive' ) ) : can you see this code line no 134 to 143, there you replace this code `<?php
    if( has_post_thumbnail() ) {
    $image = ”;
    $title_attribute = apply_filters( ‘the_title’, get_the_title( $post->ID ) );
    $image .= ‘<figure class=”post-featured-image”>’;
    $image .= ‘<a href=”‘ . get_permalink() . ‘” title=”‘.the_title( ”, ”, false ).'”>’;
    $image .= get_the_post_thumbnail( $post->ID, ‘featured’, array( ‘title’ => esc_attr( $title_attribute ), ‘alt’ => esc_attr( $title_attribute ) ) ).'</a>’;
    $image .= ‘</figure><!– .post-featured-image –>’;
    echo $image;
    } ?>` with

    <?php
    			if( has_post_thumbnail() ) {
    				$image = '';        			
    	     		$title_attribute = apply_filters( 'the_title', get_the_title( $post->ID ) );
    	     		$image .= '<figure class="post-featured-image">';
    	  			$image .= '<a href="' . get_permalink() . '" title="'.the_title( '', '', false ).'">';
    	  			$image .= get_the_post_thumbnail( $post->ID, 'featured', array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $title_attribute ) ) ).'</a>';
    	  			$image .= '</figure><!-- .post-featured-image -->';
    	  			echo $image;
      		} ?>

    with

     <?php
            if( has_post_thumbnail() ) {
              $image = '';              
                $title_attribute = apply_filters( 'the_title', get_the_title( $post->ID ) );
                $image .= '<figure class="post-featured-image">';
                $image .= '<a href="' . get_permalink() . '" title="'.the_title( '', '', false ).'">';
                $image .= get_the_post_thumbnail( $post->ID, 'featured-medium', array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $title_attribute ) ) ).'</a>';
                $image .= '</figure><!-- .post-featured-image -->';
                echo $image;
            } ?>
    

    Paste this code for single functions too on line no 238
    if ( ! function_exists( 'ultimate_theloop_for_single' ) ) :
    Add the above code just you have done it now

     <?php
            if( has_post_thumbnail() ) {
              $image = '';              
                $title_attribute = apply_filters( 'the_title', get_the_title( $post->ID ) );
                $image .= '<figure class="post-featured-image">';
                $image .= '<a href="' . get_permalink() . '" title="'.the_title( '', '', false ).'">';
                $image .= get_the_post_thumbnail( $post->ID, 'featured-medium', array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $title_attribute ) ) ).'</a>';
                $image .= '</figure><!-- .post-featured-image -->';
                echo $image;
            } ?>
    

    Thank you!

    #25738

    Hi aris,

    We cannot provide you all step by step. For this you need to hire a developer.
    First of all create two files styles.css and functions.php file
    under functions.php file add this code
    unhook this functions
    add_action( 'ultimate_loop_content', 'ultimate_theloop', 10 ); with `remove_action( ‘ultimate_loop_content’, ‘ultimate_theloop’, 1
    0 );`

    After doing it add this code add this code

    add_action(‘init’,’unhook_thematic_functions’);
    
    add_action( 'ultimate_loop_content', 'ultimate_loop_content_child', 10 );
    /**
     * Shows the loop content
     */
    function ultimate_loop_content_child() {
    	if( is_page() ) {
    		if( is_page_template( 'page-templates/page-template-blog-image-large.php' ) ) {
    			ultimate_theloop_for_template_blog_image_large();
    		}
    		elseif( is_page_template( 'page-templates/page-template-blog-image-medium.php' ) ) {
    			ultimate_theloop_for_template_blog_image_medium();
    		}
    		elseif( is_page_template( 'page-templates/page-template-blog-full-content.php' ) ) {
    			ultimate_theloop_for_template_blog_full_content();
    		}
        else {
        ultimate_theloop_for_page();
        }
    	}
    	elseif( is_single() ) {
    		ultimate_theloop_for_single();
    	}
    	elseif( is_search() ) {
    		ultimate_theloop_for_search();
    	}
    	else {
    		ultimate_theloop_for_archive();
    	}
    }
    

    Now your child theme funtions is ready. Now go to the theme folder -> inc -> structure -> content-extension.php on line no 86 you will find this code

    /****************************************************************************************/
    if ( ! function_exists( 'ultimate_theloop_for_archive' ) ) :

    and copy from this line 86 to line no 735 where in line no 735 you will find this code.

          $wp_query = $temp_query;
          wp_reset_postdata();
    }
    endif;
    /****************************************************************************************/

    Are you still with me? Ok then you need to change the code in your functions.php file
    under this functions
    if ( ! function_exists( 'ultimate_theloop_for_archive' ) ) : can you see this code line no 134 to 143, there you replace this code `<?php
    if( has_post_thumbnail() ) {
    $image = ”;
    $title_attribute = apply_filters( ‘the_title’, get_the_title( $post->ID ) );
    $image .= ‘<figure class=”post-featured-image”>’;
    $image .= ‘<a href=”‘ . get_permalink() . ‘” title=”‘.the_title( ”, ”, false ).'”>’;
    $image .= get_the_post_thumbnail( $post->ID, ‘featured’, array( ‘title’ => esc_attr( $title_attribute ), ‘alt’ => esc_attr( $title_attribute ) ) ).'</a>’;
    $image .= ‘</figure><!– .post-featured-image –>’;
    echo $image;
    } ?>` with

    <?php
    			if( has_post_thumbnail() ) {
    				$image = '';        			
    	     		$title_attribute = apply_filters( 'the_title', get_the_title( $post->ID ) );
    	     		$image .= '<figure class="post-featured-image">';
    	  			$image .= '<a href="' . get_permalink() . '" title="'.the_title( '', '', false ).'">';
    	  			$image .= get_the_post_thumbnail( $post->ID, 'featured', array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $title_attribute ) ) ).'</a>';
    	  			$image .= '</figure><!-- .post-featured-image -->';
    	  			echo $image;
      		} ?>

    with

     <?php
            if( has_post_thumbnail() ) {
              $image = '';              
                $title_attribute = apply_filters( 'the_title', get_the_title( $post->ID ) );
                $image .= '<figure class="post-featured-image">';
                $image .= '<a href="' . get_permalink() . '" title="'.the_title( '', '', false ).'">';
                $image .= get_the_post_thumbnail( $post->ID, 'featured-medium', array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $title_attribute ) ) ).'</a>';
                $image .= '</figure><!-- .post-featured-image -->';
                echo $image;
            } ?>
    

    Paste this code for single functions too on line no 238
    if ( ! function_exists( 'ultimate_theloop_for_single' ) ) :
    Add the above code just you have done it now

     <?php
            if( has_post_thumbnail() ) {
              $image = '';              
                $title_attribute = apply_filters( 'the_title', get_the_title( $post->ID ) );
                $image .= '<figure class="post-featured-image">';
                $image .= '<a href="' . get_permalink() . '" title="'.the_title( '', '', false ).'">';
                $image .= get_the_post_thumbnail( $post->ID, 'featured-medium', array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $title_attribute ) ) ).'</a>';
                $image .= '</figure><!-- .post-featured-image -->';
                echo $image;
            } ?>
    

    If you are still unable then you need to hire a developer to fix it.
    Thank you!

    #25740
    aris
    Participant

    First of all,

    THANK YOU! i haven’t tried it yet but only the support you are showing means alot to me. Again, Thank You

    i will check it later and tell you if worked 😉

    regards,

    Aris

    #25743
    aris
    Participant

    Hello there…

    IT WORKED!

    what i had to do is copy the modified content-extension.php lines 86-735 to the functions.php of the child theme.

    I have one question though…(sorry for so many questions)

    In your Blog-Image-Medium Layout the test is in the left of the image

    https://www.themehorse.com/preview/ultimate-pro/blog-image-medium/

    In my modified code the Image is showing however the text is showing below the image and not next to it. I need it to be exactly like yours because its more beautiful

    http://www.artech-it.com/category/education/

    can you please help?

    regards,

    Aris

    #25759

    Ok that’s great aris and just do one things.

    can you see this code in line no 100 of content-extension.php, There you will find this code
    <section id="post-<?php the_ID(); ?> clearfix" <?php post_class(); ?>>
    Replace this above code with
    <section id="post-<?php the_ID(); ?> clearfix" class="post blog-medium" > in your child theme.

    Thank you!

Viewing 15 posts - 1 through 15 (of 17 total)
  • You must be logged in to reply to this topic.