Forum Replies Created

Viewing 10 replies - 16 through 25 (of 25 total)
  • Forum: Fixing WordPress
    In reply to: Multiple Loops
    Thread Starter Danny159

    (@danny159)

    Ahhh but even this doesnt work:

    <?php $the_query = new WP_Query('page_id=18'); ?>

    Sorry for been stupid!

    Forum: Fixing WordPress
    In reply to: Multiple Loops
    Thread Starter Danny159

    (@danny159)

    Hi Thanks for you reply…

    I replaced some code and added:

    <?php
    	$the_query = new WP_Query(array('page_id' => "18", 'post_type' => 'page'));
    	while($the_query->have_posts()) : $the_query->the_post();
        ?>

    I changed the id’s around and still nothing… actually nothing at all shows now except my recent posts….

    Here is my full new code: https://pastebin.com/07D6Zd9R

    Dan

    Also no pages have children yet

    Forum: Fixing WordPress
    In reply to: Multiple Loops
    Thread Starter Danny159

    (@danny159)

    Please see the code here: https://pastebin.com/W1MPqEa0

    Forum: Fixing WordPress
    In reply to: WP Gallery
    Thread Starter Danny159

    (@danny159)

    Brill both your posts helped and worked, kinda thick about the dups but ha ho… ??
    Thanks guys.

    Forum: Themes and Templates
    In reply to: Contact Form
    Thread Starter Danny159

    (@danny159)

    I am not using a plugin, I hard coded it into the theme

    Dan

    Forum: Fixing WordPress
    In reply to: WP Gallery
    Thread Starter Danny159

    (@danny159)

    Also how do you remove images from a gallery without deleting them from the Library? I seem to have some in twice

    Dan

    Forum: Fixing WordPress
    In reply to: Get Parent Slug
    Thread Starter Danny159

    (@danny159)

    Ok I sorted this, I didnt think you could run any php in a template file but you can… so here is how I fixed it just incase anyone wants to know:

    <?php
    $parentslug = explode("/", $_SERVER['REQUEST_URI']);
    if($parentslug[1] == "parent1"){
    	$theNav = "nav5";
    }else
    if($parentslug[1] == "parent2"){
    	$theNav = "nav4";
    }else
    if($parentslug[1] == "parent3"){
    	$theNav = "nav3";
    }else
    if($parentslug[1] == "parent4"){
    	$theNav = "nav2";
    }else{
    	$theNav = "aboutnav";
    }
    
    wp_nav_menu(array('theme_location' => $theNav, 'items_wrap' => '<ul>%3$s</ul>', 'container' => false));
    ?>
    Forum: Themes and Templates
    In reply to: Theme Nav
    Thread Starter Danny159

    (@danny159)

    I have got it all working, I just need some help with the wp_nav_menu() function to get it to make the code I have above?

    As what I have now is as following:
    <?php wp_nav_menu( array( 'theme_location' => 'main', 'container' => 'Alignment', 'menu_class' => 'MenuItem' ) ); ?>

    But I get this from that…. not like the static code above….

    <div class="MenuItem">
        <ul>
            <li class="page_item page-item-10 current_page_item"><a href="#">Link</a></li>
            <li class="page_item page-item-20"><a href="#">Link</a></li>
            <li class="page_item page-item-18"><a href="#">Link</a></li>
            <li class="page_item page-item-22"><a href="#">Link</a></li>
        </ul>
    </div>

    Dan

    Forum: Fixing WordPress
    In reply to: Get Parent Slug
    Thread Starter Danny159

    (@danny159)

    That doesnt seem to show me the slug?

    What I want to do is in my template I want to do an if statement… eg…

    if($parent_slug == "cat1"){
        wp_nav_menu(array('theme_location' => 'main', 'menu_class' => 'simple-nav', 'container' => false));
    }else{
        wp_nav_menu(array('theme_location' => 'cat2', 'menu_class' => 'simple-nav', 'container' => false));
    }

    [ Please do not bump, it’s not permitted here. ]

    Forum: Fixing WordPress
    In reply to: Paging not working
    Thread Starter Danny159

    (@danny159)

    Ahh fixed, see this guys code:

    <?php
    global $wp_query;
    $paged = get_query_var('paged') ? get_query_var('paged') : 1;
    $args = array(
    	'post_type' => 'CUSTOM_POST_NAME',
    	'product_category' => 'CATEGORY_NAME',
    	'posts_per_page' => 6,
    	'post_status' => 'publish',
    	'orderby' => 'menu_order',
    	'order' => 'DESC',
    	'paged' => $paged
    );
    $wp_query = new WP_Query($args);
    
    while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>
    	<a href="<?php echo get_permalink(); ?>"><?php the_title(); ?></a>
    <?php endwhile; ?>
Viewing 10 replies - 16 through 25 (of 25 total)