Blog Template

Home Forums Jevelin Theme Blog Template

Home Forums Jevelin Theme Blog Template

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • [email protected]
    Participant

    Inside of the blog template page in the theme /page-blog.php there seems to be a bug for both the category listing and the blog listing details, for the category listing I had to rework the ternary operator so it would list the categories correctly and for the category filters i had to rework this because the category names were being concatenated into one long string and breaking the page. i am slightly concerned with this because i have modified the theme files directly and do not want my work to be erased in future updates, please advise. For reference the changes are prefixed with comments.

    [email protected]
    Participant

    <div>
    <div>/////////////////////////////////////</div>
    <div>                // fix category check</div>
    <div>                //Fix: Check if category exists and either has posts or you want to show empty categories</div>
    <div>                /*if( !empty( $category->count ) && $category->count > 0 ) : ?>*/</div>
    <div>                if( $category && !is_wp_error( $category ) && ( $category->count > 0 || true ) ) : ?></div>
    </div>
    <div></div>
    <div></div>
    <div>
    <div>
    <div>////////////////////////////////////////////////</div>
    <div>                    //Updated Section to fix category filter issue</div>
    <div>                    /*</div>
    <div>                       The debug output shows that the category filter is concatenating all the category names into one long string: “Day 1Day 2Day 3Day 4Day 5Day 6Day 7Day 8Day 9Day 10Day 11Day 12” instead of treating them as separate categories.</div>
    <div>                       the problem is in the category handling logic. When using category_name in WP_Query, it expects category slugs separated by commas, not names concatenated together.</div>
    <div>                       */</div>
    <div>                    // if( $cat_att == ‘category_name’ && is_array( $cat_var ) ) :</div>
    <div>                    //  $cat_var = implode( ‘,’, $cat_var );</div>
    <div>                    // endif;</div>
    <div>                    if( $cat_att == ‘category_name’ && is_array( $cat_var ) ) :</div>
    <div>                        // Fix: Convert category IDs to slugs and join with commas</div>
    <div>                        $category_slugs = array();</div>
    <div>                        foreach( $cat_var as $cat_id ) {</div>
    <div>                            $category = get_term_by( ‘id’, $cat_id, ‘category’ );</div>
    <div>                            if( $category ) {</div>
    <div>                                $category_slugs[] = $category->slug;</div>
    <div>                            }</div>
    <div>                        }</div>
    <div>                        $cat_var = implode( ‘,’, $category_slugs );</div>
    <div>                    endif;</div>
    <div>                    /* End fix */</div>
    </div>
    </div>

    Shufflehound
    Moderator

    Hello,

     

    Thanks for sharing the details and your notes. We reviewed the original page-blog.php file, and we don’t have any known issues related to category listings or filters in recent theme versions. Your described issue might have been caused by an earlier or modified theme version, or by a plugin altering the query output.

     

    To keep your fixes safe, we recommend moving the modified file to a child theme (using the same folder structure). That way, your edits won’t be lost when updating the theme.

     

    Could you also share a screenshot or a live example of the issue on your site? That would help us better understand what’s happening and confirm if there’s something that needs to be fixed in the theme itself.

     

    Best regards,

    Shufflehound team

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