-
Posted in : TheBlogger
-
On the homepage under the featured section we’d like to be able to have multiple categories rather than just the most recent posts but keeping the same style we have now. We thought we could do this with the widget area ‘Footer Subscribe’ but the only posts widget is most recent so we can’t filter by category.
Would it be possible to have multiple sections like in the image attached, one for each category? For example, New, Events, Video. 3 we could have a row of 3 posts from each category?
We have edited the template code to now have two sections, but we can’t figure out how to change the recent posts to a specific category on each section. See code below.
<?php
get_header();
?><?php
global $theblogger_sidebar;
theblogger_sidebar_yes_no();
?><?php
theblogger_featured_area();
?><div id=”main” class=”site-main”>
<div class=”layout-medium”>
<div id=”primary” class=”content-area <?php echo esc_attr($theblogger_sidebar); ?>”>
<div id=”content” class=”site-content” role=”main”>
<?php
theblogger_archive_title();
?><?php
$theblogger_1st_full = theblogger_1st_full_yes_no();
?><div class=”blog-grid-wrap”>
<div class=”blog-stream blog-grid blog-small masonry <?php if ($theblogger_1st_full == ‘Yes’) { echo ‘first-full’; } ?>” data-layout=”<?php echo theblogger_blog_grid_type(); ?>” data-item-width=”<?php theblogger_blog_grid_post_width(); ?>”>
<?php
if (have_posts()) :$category_link_style = theblogger_category_link_style();
while (have_posts()) : the_post();
?>
<article id=”post-<?php the_ID(); ?>” <?php post_class(esc_attr($category_link_style)); ?>>
<div class=”hentry-wrap”>
<?php
if ($theblogger_1st_full == ‘Yes’)
{
theblogger_featured_media__layout_grid($first_full = ‘Yes’, theblogger_blog_grid_type());
$theblogger_1st_full = ‘No’;
}
else
{
theblogger_featured_media__layout_grid($first_full = ‘No’, theblogger_blog_grid_type());
}
?>
<div class=”hentry-middle”>
<header class=”entry-header”>
<?php
theblogger_meta(‘above_title’);
?>
<h2 class=”entry-title”>
“><?php the_title(); ?>
</h2>
<?php
theblogger_meta(‘below_title’);
?>
</header> <!– .entry-header –>
<div class=”entry-content”>
<?php
theblogger_content();
?>
</div> <!– .entry-content –>
<?php
theblogger_meta(‘below_content’);
?>
</div> <!– .hentry-middle –>
</div> <!– .hentry-wrap –>
</article>
<?php
endwhile;
else :theblogger_content_none();
endif;
?>
</div> <!– .blog-stream .blog-grid .blog-small .masonry –>
</div> <!– .blog-grid-wrap –>
<?php
theblogger_blog_navigation();
?>
</div> <!– #content .site-content –>
</div> <!– #primary .content-area –>
<?php
if ($theblogger_sidebar != “”)
{
theblogger_sidebar();
}
?>
</div> <!– .layout-medium –>
</div> <!– #main .site-main –><?php
//======================================================================
// NEW SECTION STARTS HERE
//======================================================================
?><div id=”main” class=”site-main”>
<div class=”layout-medium”>
<div id=”primary” class=”content-area <?php echo esc_attr($theblogger_sidebar); ?>”>
<div id=”content” class=”site-content” role=”main”>
<?php
theblogger_archive_title();
?><?php
$theblogger_1st_full = theblogger_1st_full_yes_no();
?><div class=”blog-grid-wrap”>
<div class=”blog-stream blog-grid blog-small masonry <?php if ($theblogger_1st_full == ‘Yes’) { echo ‘first-full’; } ?>” data-layout=”<?php echo theblogger_blog_grid_type(); ?>” data-item-width=”<?php theblogger_blog_grid_post_width(); ?>”>
<?php
if (have_posts()) :$category_link_style = theblogger_category_link_style();
while (have_posts()) : the_post();
?>
<article id=”post-<?php the_ID(); ?>” <?php post_class(esc_attr($category_link_style)); ?>>
<div class=”hentry-wrap”>
<?php
if ($theblogger_1st_full == ‘Yes’)
{
theblogger_featured_media__layout_grid($first_full = ‘Yes’, theblogger_blog_grid_type());
$theblogger_1st_full = ‘No’;
}
else
{
theblogger_featured_media__layout_grid($first_full = ‘No’, theblogger_blog_grid_type());
}
?>
<div class=”hentry-middle”>
<header class=”entry-header”>
<?php
theblogger_meta(‘above_title’);
?>
<h2 class=”entry-title”>
“><?php the_title(); ?>
</h2>
<?php
theblogger_meta(‘below_title’);
?>
</header> <!– .entry-header –>
<div class=”entry-content”>
<?php
theblogger_content();
?>
</div> <!– .entry-content –>
<?php
theblogger_meta(‘below_content’);
?>
</div> <!– .hentry-middle –>
</div> <!– .hentry-wrap –>
</article>
<?php
endwhile;
else :theblogger_content_none();
endif;
?>
</div> <!– .blog-stream .blog-grid .blog-small .masonry –>
</div> <!– .blog-grid-wrap –>
<?php
theblogger_blog_navigation();
?>
</div> <!– #content .site-content –>
</div> <!– #primary .content-area –>
<?php
if ($theblogger_sidebar != “”)
{
theblogger_sidebar();
}
?>
</div> <!– .layout-medium –>
</div> <!– #main .site-main –><?php
get_footer();
?>Hi, sorry we don’t provide support for customizations that includes editing core php files.
This is not available by default, needs further customizations, if you are not familiar to coding you may consider hiring an expert at wpkraken.io to do the job for you.
You must be logged in and have valid license to reply to this topic.