specific category on front page

Discussion in 'BlogsTrend WordPress Theme' started by interaction, Mar 21, 2015.

  1. interaction

    interaction Member

    Joined:
    Mar 20, 2015
    Messages:
    42
    Likes Received:
    0
    Hi,

    I want just to include on category on my front page. found this code

    function my_home_category( $query ) {
    if ( $query->is_home() && $query->is_main_query() ) {
    $query->set( 'cat', '230');
    }
    }
    add_action( 'pre_get_posts', 'my_home_category' );

    but if I include this in the custom css it doesn't work. any idea how to solve?

    thanks!

    Yvon
     
  2. sameerwalkar

    sameerwalkar Guest

    Hi,

    In custom CSS you can able to put your on CSS code. To put such codes you need to customization in your source code.

    Regards,
    Sameer
     
  3. interaction

    interaction Member

    Joined:
    Mar 20, 2015
    Messages:
    42
    Likes Received:
    0
    Hi Sameer,

    Thanks for your reply. In which source code should I put this? Put my webiste online, see http://www.holidaybreaks.nl/ On the front page I just want the category Tips. Also the home button does not show (only when you hoover). How to solve this?

    Really happy with the theme. Found most of my questions on the forum.

    Thanks for your help!

    Yvonne
     
  4. sameerwalkar

    sameerwalkar Guest

    Hi,

    Please paste the code given below in Custom CSS section
    (Appearance -> Theme Options -> Styling Options -> Custom CSS) of your dashboard.

    Code:
    #menu .ddsmoothmenu li:first-child a {
      color: #000 ! important;
    }
    Also Kindly explain what exactly the sentence "On the front page I just want the category Tips" is all about, so that I can guide you accordingly.

    Regards,
    Sameer
     
  5. interaction

    interaction Member

    Joined:
    Mar 20, 2015
    Messages:
    42
    Likes Received:
    0
    On the front page I would like to show just the posts in the category Tips (as now made on a separate page, see http://www.holidaybreaks.nl/categorie/tips/). So not the latest posts but just from one specific category.

    Thanks for your help! Am happy with you ;/).

    Yvon
     
  6. sameerwalkar

    sameerwalkar Guest

    Hi,

    So I hope you have resolved your problem by your own. As you have created a separate page for the same and its looking perfectly fine. :)

    Regards,
    Sameer
     
  7. interaction

    interaction Member

    Joined:
    Mar 20, 2015
    Messages:
    42
    Likes Received:
    0
    Not quite ;-). how do I get that on the front page?

    regards

    Yvonne
     
  8. sameerwalkar

    sameerwalkar Guest

    Hi,

    Apply the below given block of code.

    Code:
    <h1><?php printf(__('Category Archives: %s', 'inkthemes_blogtrend'), 'Tips'); ?></h1>
    Refer the screenshot below, where to put this block of code:

    blogstrend category-archieve.png

    Regards,
    Sameer
     
  9. interaction

    interaction Member

    Joined:
    Mar 20, 2015
    Messages:
    42
    Likes Received:
    0
    Hi Sameer,

    Unfortunately this does not do the trick, it just shows Categorty Archives: Tips between the slider and the posts. See http://www.holidaybreaks.nl/

    Yvonne
     
  10. sameerwalkar

    sameerwalkar Guest

    Hi,

    Kindly Use the below code it will show all the blogs according to category on homepage only you need to provide your category id currently I have put 'category' => 230 .

    Code:
     <?php
    $args = array ( 'category' => 230, 'posts_per_page' => 5);
    $myposts = get_posts( $args );
    foreach( $myposts as $post ) :    setup_postdata($post);
    ?>
    <div class="post">
                <div class="post_list">
                    <h1 class="post_title"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">
                            <?php the_title(); ?>
                        </a></h1>
                    <?php if ((function_exists('has_post_thumbnail')) && (has_post_thumbnail())) { ?>
                        <?php inkthemes_get_thumbnail(224, 145); ?>                   
                    <?php } else { ?>
                        <?php inkthemes_get_image(224, 145); ?>
                        <?php
                    }
                    ?>
                    <div class="post_content">
                        <ul class="post_meta">
                            <li class="date"><?php the_time('F j, Y'); ?></li>
                            <li class="category"><?php the_category(', '); ?></li>
                            <li class="admin"><?php the_author_posts_link(); ?></li>
                        </ul>
                        <?php the_excerpt(); ?>
                        <a class="read-more" href="<?php the_permalink() ?>">Read More..</a>
                    </div>
                </div>
    <?php endforeach; ?>
                    <!--End Post-->
                    <div class="clear"></div>
        <?php inkthemes_pagination(); ?>
    </div>
    Refer the screenshot below where to put this:

    blostrend-category.png

    Regards,
    Sameer
     
  11. interaction

    interaction Member

    Joined:
    Mar 20, 2015
    Messages:
    42
    Likes Received:
    0
    doesn't do the trick either ... and then also the right side disappears and is then under all the posts. so put it back to the old situation.

    Yvon
     
  12. sameerwalkar

    sameerwalkar Guest

    Hi,

    Please provide the following information listed below.
    This Thread Link:
    Your Website URL:
    WordPress Username:
    WordPress Password:
    Send this information on our email at [email protected]
    Regards,
    Sameer
     
  13. sameerwalkar

    sameerwalkar Guest

    Hi,

    Kindly check we have fixed your issue. Let me know if have further any doubts.

    Regards,
    Sameer
     

Share This Page