Support » Theme: MH Magazine lite » How to get a single Category to Show on blog posts page

  • Resolved fantasy_5

    (@fantasy_5)


    Hi!

    I love this awesome theme and I sincerely hope that you can help me resolve this issue. I would like to have a single category (Celebrity Scope Starring the Art of You) show up on my (blog)page which displays all posts. I read some information that pertained to coding the loop.php which is what I desire or to put code in pc custom css plug in so that if theme updates i don’t lose changes. If I can get a code to put in custom css that would be great.

    This is the loop file:

    <?php /* Loop Template used for index/archive/search */
    $mh_magazine_lite_options = mh_magazine_lite_theme_options();
    $excerpt_length = empty($mh_magazine_lite_options[‘excerpt_length’]) ? ‘125’ : $mh_magazine_lite_options[‘excerpt_length’];
    ?>
    <article <?php post_class(); ?>>
    <div class=”loop-wrap clearfix”>
    <div class=”loop-thumb”>
    “>
    <?php if (has_post_thumbnail()) { the_post_thumbnail(‘loop’); } else { echo ‘<img src=”‘ . get_template_directory_uri() . ‘/images/noimage_174x131.png’ . ‘” alt=”No Picture” />’; } ?>

    </div>
    <header class=”loop-data”>
    <h3 class=”loop-title”>” rel=”bookmark”><?php the_title(); ?></h3>
    <p class=”meta”>” rel=”bookmark”><?php $date = get_the_date(); echo $date; ?> // <?php comments_number(__(‘0 Comments’, ‘mh-magazine-lite’), __(‘1 Comment’, ‘mh-magazine-lite’), __(‘% Comments’, ‘mh-magazine-lite’)); ?></p>
    </header>
    <?php mh_excerpt($excerpt_length); ?>
    </div>
    </article>

    This is what I’m trying to accomplish:

    if( is_page( ‘blog’ ) {

    query_posts( array( ‘category_name’ => ‘celebrity scope starring the art of you’ ) );

    }

    This is the article where I saw similar instructions that may help me resolve this issue, but I think I’m doing something wrong. 🙁 I’ve been at this constantly. Please help.

Viewing 10 replies - 1 through 10 (of 10 total)
  • Hi fantasy_5,

    thanks for using MH Magazine lite and we’re happy that you like the theme.

    Sorry, we can’t offer free support for custom coding. But in general this is nothing you can solve with CSS or a custom CSS plugin. What you mean probably is a child theme.

    To achieve what you want you also could for example code a custom page template with a custom query and then use that page template for your static front page.

    Anyway, if you’re not familiar with coding, you could try to find some help in the general WordPress support forums: How-To and Troubleshooting.

    Hi!

    Thanks for responding. Do you know the exact css that could be used to accomplish this? The link that I provided seems to be the perfect solution, but for a different theme. I have a css plug in. I will be creating a child theme also.

    I just need to know what query would achieve this and where to place it in the… loop.php or page.php.

    As mentioned before, this doesn’t have anything to do with CSS. CSS code is only for styling purposes: CSS Tutorial.

    The query that usually is located in index.php can be found inside the function mh_loop(); within the file functions.php. But as mentioned before, you could for example create a child theme and then add a custom page template if you only want to have custom content on your front page.

    But if you’re not familiar with coding, you probably shouldn’t edit PHP code as you can easily break your site. In that case you might want to hire a freelancer or an agency that offers custom WordPress development.

    And as also mentioned before, as an alternative you could also ask for help in the general forums. If you open a thread there, ask kindly for help and in case someone has time to assist you with this, there is a pretty good chance that you will get help.

    Hi, MH Themes!

    I just want you to know that I have resolved my issue and it was an easy fix without a child theme or additional coding, In order to get posts from a single category to show up on a specific page…

    1. create the post and select the specific category, then publish the post.

    2. Go to the menu in your admin. and instead of adding an additional page to the nav menu you can add an actual category to the nav menu instead. The category name that appears on the actual navigation menu, when you add it to your nav bar, can be changed to whatever display name you’d like.

    My category is Black History, but when you go to my site the nav page menu display name is 365 Black.

    For instance, my blog posts page shows all posts that are added, but 365 Black shows only posts from the Black History category. You can do this for as many categories as you’d like.

    I hope that this helps someone. Thanks for your assistance.

    One last question… Which .php file is the actual posts file that shows up on the blog’s front page? Is it the page the .php?

    If you mean with “blog’s front page” the regular posts page in WordPress (and not a static front page), then this is handled by index.php and the markup for the posts on archives is located in loop.php.

    Thank you!

    Hi!

    Thanks for all of your help.
    by the way is it possible to have the author name show up in the excerpt of the post rather than only when you click on the full post its self on the blog posts page? If so, how can I go about achieving this? Here is the link to my blog page.

    https://celebrityscope.net/blog

    Lil Weezyana Fest X’s Tidal on August 28, 2015!
    08/19/2015 // 0 Comments
    Tidal and the Lil Weezyana Fest Are Teaming Up If you’re a Lil Wayne and Hot Boys fan like most of the coolest people on […]

    So in other words the excerpt is fine I’m looking for the By (author) line before the date and comments.

    This isn’t possible out of the box and requires theme customizations. If you’re familiar with coding, you could create a child theme and modify the file loop.php as you like.

    You can find additional information here: https://codex.wordpress.org/Function_Reference/get_the_author

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘How to get a single Category to Show on blog posts page’ is closed to new replies.