WordPress.org

Ready to get started?Download WordPress

Forums

Minimatica
[closed] Remove folded banner in Minimatica (181 posts)

  1. deepbevel
    Member
    Posted 1 year ago #

    this get's one post from each category if used in loop-slider.php

    <?php	 		global $wp_query, $query_string;
    	$paged = get_query_var( 'paged' );  
    
    //this is the part I added                
    
    $categories=get_categories($cat_args);
      foreach($categories as $category) {
        $args=array(
      'showposts' => 1,
     'category__in' => array($category->term_id),
    
    //additions end
    
    'paged' => $paged,
    'ignore_sticky_posts' => 0
    );

    however, for some reason it puts all the featured images in a vertical column, let me know if that's the case for you, could be because of something else in my theme,it's pretty tweeked..

  2. deepbevel
    Member
    Posted 1 year ago #

    actually, hang on, it has to do with where I close the foreach with this tag:

    <?php }?>

    I'll get it..

  3. deepbevel
    Member
    Posted 1 year ago #

    maybe not..
    I think we're better off calling specific posts in the home slider, I'll try later.

  4. Juliefitz
    Member
    Posted 1 year ago #

    Hey,

    I think i get it so far, lol. I am dealing with the tax man but will get up to speed with you later today. Then we will find out if I really get it.

  5. Juliefitz
    Member
    Posted 1 year ago #

    Right I think I am up to date....

    I assumed that we were starting with the loop-slider.php in its original state.

    I have created and uploaded the loop-slider-catagories.php and made the modifications you suggested to the loop-slider.php and the catagory.php

    I have not yet made the final modification (the one you said put all the images in a vertial position) as I think you are still exploring this, but let me know if you want me to try it.

    Current situaton;

    On opening the site, the slider is there with the arrow to the right leading to the other sliders.

    When you select an post on the slider (any of them) it re-opens the slider, but now with no arrow to the right.

    If you select a post now, it opens the post itself.

    If instead of selecting the first slider, you navigate to the next slider using the arrow to the right; the same happens, you press the slider once and the slider appears again, then each slider you select leads to the relevent post.

    Hopfully this is what you were expecting to be the case.

  6. deepbevel
    Member
    Posted 1 year ago #

    How many posts per page do you have in wp settings?
    if you have created 4 posts, and your blog setting is for 4 posts per page, you should see 4 posst in the slider. If there's more than 4, you'll get the nav arrow.
    Theee'a also a posts per page argument in the loop.slider query, it is 4 by default.
    But we shall work on that later, next for the home slider (we named it loop-slider-categories) I'm going to make a query with specific posts, they will be caled by their ID#, and link to what ever we like, and we're linking them to their categories.

  7. deepbevel
    Member
    Posted 1 year ago #

    In in loop-slider.php, Remove the code I postsed above which get links as categories and replace with the default permalink code:

    <a class="overlay" href="<?php the_permalink(); ?>" rel="bookmark"></a>

    add this to the end of the array

    'post__in' => array(625,1072)

    add the post id's you want to call in the slider, but you'll want to call 4 posts for it to look right.

    loop-slider-categories.php is still used by the categories.php template, and still functions as the default loop slider (with posts queried by category and linked to the content like normal), for all instances of the slider except the homepage.

  8. deepbevel
    Member
    Posted 1 year ago #

    -you can add as many post id's as you want, just use commas between..
    I'm not sure how this effects posts per page at this point.. probably still in effect.

  9. Juliefitz
    Member
    Posted 1 year ago #

    I am happy with 4 posts per slider so no need to work on that.

  10. deepbevel
    Member
    Posted 1 year ago #

    okay, just list their id's in the array, it should work..

  11. deepbevel
    Member
    Posted 1 year ago #

    oops, i goofed. We still need the home slider posts to link to categories. I'm confusing the two templates..

  12. Juliefitz
    Member
    Posted 1 year ago #

    I am a bit confused.

    I have replaced the code.

    What is an array? Does this mean put it at the bottom of the code?

    List their id's in the array (not a clue)

  13. Juliefitz
    Member
    Posted 1 year ago #

    Should I put the code back in that I just took out?

  14. deepbevel
    Member
    Posted 1 year ago #

    so we still need:

    <a class="overlay" href="
    
    <?php
    $the_cat = get_the_category();
    $category_name = $the_cat[0]->cat_name;
    $category_link = get_category_link( $the_cat[0]->cat_ID );
    ?>
    <?php echo $category_link ?>" title="<?php echo $category_name ?>"><?php echo $category_name ?>
    "
    </a>

    in loop-slider.php, and loop-slider-categories.php has the defualt permalink code. I think. haha

  15. deepbevel
    Member
    Posted 1 year ago #

    the array is list of arguments in the query,
    so it will look like this:

    <?php	 		global $wp_query, $query_string;
    	$paged = get_query_var( 'paged' );
    	$args = array(
    		 'post__in' => array(625,1072)
    		'paged' => $paged,
    		'ignore_sticky_posts' => 0
    
    );
    	$args = wp_parse_args( $args, $wp_query->query );
    ?>
  16. deepbevel
    Member
    Posted 1 year ago #

    these last two codes both modify loop-slider.php, otherwise we still have loop-slider-categories.php with default code for the theme, and used by categories.php.

  17. deepbevel
    Member
    Posted 1 year ago #

    so, in loop-category.php the top of the template looks like this, we added the part that says "get template part loop slider categories", everything else is default.

    <?php
    /**
     * Template for category archives
     *
     * @package WordPress
     * @subpackage Minimatica
     * @since Minimatica 1.0
     */
    
    get_header(); ?>
    
    <?php if( ( 'gallery' == minimatica_get_option( 'category_view' ) ) && ( get_query_var( 'cat' ) != minimatica_get_option( 'blog_category' ) ) ) : ?>
    
    <div id="slider">
    		<?php get_template_part( 'loop-slider-categories' ); ?>
    	</div><!-- #slider -->
  18. deepbevel
    Member
    Posted 1 year ago #

    you need to know exactly what you changed, so you can preserve it when you update your theme. Then get a child theme and apply these mods to it.

  19. Juliefitz
    Member
    Posted 1 year ago #

    Before we carry on. I seem to have two sets of php files in my editor page.

    For example footer;

    I now how a footer(_vti_cnf/footer.php)
    and the the footer.php

    Have I messed something up?

  20. Juliefitz
    Member
    Posted 1 year ago #

    when you say loop-catagory.php do you mean loop-slider-catagory.php?

  21. Juliefitz
    Member
    Posted 1 year ago #

    no, i think you mean catagory.php

    yes?

  22. Juliefitz
    Member
    Posted 1 year ago #

    when i put;

    <?php global $wp_query, $query_string;
    $paged = get_query_var( 'paged' );
    $args = array(
    'post__in' => array(625,1072)
    'paged' => $paged,
    'ignore_sticky_posts' => 0

    );
    $args = wp_parse_args( $args, $wp_query->query );
    ?>

    my slider vanished. Dont you need to keep the line;

    'posts_per_page' => 4,

    How are you putting your code into neat grey boxes on here?????

  23. deepbevel
    Member
    Posted 1 year ago #

    no posts appear maybe because those posts id's are not for your posts? be sure to change the id's to the id's for your posts.

    use the "code" button, it's special back-ticks that go before and after your code to get those cool boxes.

  24. deepbevel
    Member
    Posted 1 year ago #

    As to the previous, I mean category.php, and not loop-slider-categories.php.
    If you have doubts about your templates, replace them with deault and only apply the mods on this page, then go from their.

  25. deepbevel
    Member
    Posted 1 year ago #

    sorry about the "loop" part,my bad.

  26. Juliefitz
    Member
    Posted 1 year ago #

    I think I might have to come at this with a fresh head.... its all getting a bit out of my comfort zone and I am gonna mess it all up if I carry on tired.

  27. deepbevel
    Member
    Posted 1 year ago #

    just follow the thread on this page, should make sence and should give you the result you want..

    You may have to replace your files to be sure, including the new template we made. then just apply the two mods to category.php and loop-slider.php. i think that's it.

  28. deepbevel
    Member
    Posted 1 year ago #

    you've come too far to quit now!

  29. deepbevel
    Member
    Posted 1 year ago #

    oh well, I'll be here when your ready. I wanna see it work for ya.

  30. Juliefitz
    Member
    Posted 1 year ago #

    I won't quit. I'll be back tomorrow when I can think straight. Too much paperwork today, I can't focus any more :)

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic

Tags