Home / Forums / DynamiX Support / Excerpt only for one category

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts

  • Pavel
    Participant

    Hi, I have 2 categories and I want to show excerpt only for one category. Is there any chance to do it with child theme? I tried to modify loaded options for this category with the help of pre_option_themeva filter, but it does not work well. Maybe due to ob_clean() function or Options framework. Any idea? Thank you for your help!

    Andy
    Andy
    Keymaster

    Hi Pavel,

    Where are you wanting to display just the excerpt?


    Pavel
    Participant

    Only for one category archive. For other category archive I want to show full posts.


    Pavel
    Participant

    I usually try to modify theme options in these cases, but it does not work with DynamiX. Here is my code:

    add_filter( 'pre_option_themeva', 'my_category_list' );
    function my_category_list() {
    if ( is_category('something') ) {
    $all_options = wp_load_alloptions();
    $themeva = $all_options["themeva"];
    $themeva = str_replace("full_post", "excerpt_image", $themeva);
    return $themeva;
    }
    }

    Andy
    Andy
    Keymaster

    Unfortunately there is no hook for this at the moment, the archive and blog pages use the standard WP loop for retrieving posts – however you could edit DynamiX/lib/inc/classes/blog-class.php

    In particular within these statements ( it retrieves the content ).

    if( is_single() || $NV_blogcontent == 'full_post' ) :

    ob_start();
    the_content();
    $content = ob_get_clean();

    $NV_description = do_shortcode($content);
    $NV_nolink='yes';

    elseif ( $NV_blogcontent=='' || $NV_blogcontent=='excerpt_image' ) :

    if ( empty($post->post_excerpt) )
    {
    $NV_description = the_advanced_excerpt('',true);
    }
    else
    {
    $NV_description = get_the_excerpt();
    }

    else :

    $NV_description = '';
    $NV_nolink='yes';

    endif;


    Pavel
    Participant

    OK, thank you. And any idea how to do it by using child theme (to update without problems)?

    And there si similar problem with excerpts. Even if excerpt field is fulfilled and “Only Excerpt” selected for Blog settings, this excerpt is not shown. I found similar issues in this support forum, but no solution… Thank you for your help.

    Other example: http://help.themeva.com/groups/tersus-wordpress-theme-support/forum/topic/blog-excerpts-not-showing-up/


    Pavel
    Participant

    Problem is probably here:

    $NV_description = get_the_excerpt();

    Function get_the_excerpt() returns only “…”, but $post->post_excerpt works well. It is probably caused somehow by using get_the_excerpt filter (Advanced excerpt plugin).

    Andy
    Andy
    Keymaster

    Hi Pavel,

    Within Settings > Excerpt, uncheck this option to use the post excerpt – “Generate excerpts even if a post has a custom excerpt attached.”

    Does that help?


    Pavel
    Participant

    Yes, thank you! I did not notice this settings (separate plugin). Sorry for bothering you…

    Still, is there any chance to change “Full Posts” into “Excerpt Only” for one category by using child theme (to update without problems)?

    Andy
    Andy
    Keymaster

    Hi,

    At this moment there isn’t a method for doing that. I’ll note this down for future development.


    Pavel
    Participant

    OK, thank you. It would be helpfull to enable choosing some settings per category (for example content length, postmeta info, etc).

Viewing 11 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic.