WordPress.org

Ready to get started?Download WordPress

Forums

Mystile homepage blog post (4 posts)

  1. Artview
    Member
    Posted 4 months ago #

    Hi!
    I am using Mystile theme by WooCommerce. I want to choose which one of my blog poststs will be displayed on my homepage. By default, it is the latest, however I want to have my first one pinned there.

    I assume I must change something in the index.php file of the Mystile theme, probably somewhere in this loop:

    <?php /* Start the Loop */ ?>
    			<?php while ( $the_query->have_posts() ) : $the_query->the_post(); $count++; ?>
    
    				<?php
    					/* Include the Post-Format-specific template for the content.
    					 * If you want to overload this in a child theme then include a file
    					 * called content-___.php (where ___ is the Post Format name) and that will be used instead.
    					 */
    	get_template_part( 'content', get_post_format() );
    				?>

    I am a beginner in PHP, so please help me to set the first blog post as the one featured on the homepage.

    I want to use it for informative purposes on the homepage, so if someone else has this problem, I also recommend to change the last line:
    get_template_part( 'content', get_post_format() );
    to
    the_content();
    than you will get just the post content without the publication date or the author.

    Best wishes,
    Greg

  2. Andrea Garza
    Member
    Posted 4 months ago #

    in the admin area of wordpress, go to the post you want stuck at the top and click edit .. in the publish box there is a thing that says visibility: public .. click the edit link next to that, put a checkmark next to Stick this post to the front page and then save the post.

    It should now be the sticky post on your home page

  3. Artview
    Member
    Posted 4 months ago #

    Thanks for this useful tip, I didn't know that option!
    So far I only have one post, but I hope it will work when I add new ones.

  4. Andrea Garza
    Member
    Posted 4 months ago #

    it should do the trick for you unless you have some kind of wonky coding in your theme .. good luck.

Reply

You must log in to post.

About this Topic