Forum Replies Created

Viewing 15 replies - 16 through 30 (of 61 total)
  • Thread Starter flint_and_tinder

    (@flint_and_tinder)

    Both those loops site within the main page loop like so…

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    <?php the_content(); ?>
    
    Loop 1
    
    Loop 2
    
    <?php endwhile; endif; ?>
    Thread Starter flint_and_tinder

    (@flint_and_tinder)

    Second loop:

    <?php $args=array(
    	'taxonomy' => 'fan_post_types',
    	'term' => 'fan-merchandise',
    	'post_type' => 'fan',
    	'posts_per_page' => 8
    	);
        $merchandise = new WP_Query($args);
        if($merchandise->have_posts()) : while($merchandise->have_posts()) :
    	$merchandise->the_post(); ?>
    
    Whatever you want to display goes here...    	
    
      <?php endwhile; endif; ?>
      <?php wp_reset_query(); // end Fans Merchandise loop. ?>
    Thread Starter flint_and_tinder

    (@flint_and_tinder)

    Hi Chris,

    I managed it like the below (which I think is similar to the original paste bin code, but without slight errors), for each loop in the template you just need something like the following. This example is for the fan-comments loop. For the fan-merchandise loop I changed the term field and $comments identifiers to suit.

    <?php $args=array(
    	'taxonomy' => 'fan_post_types',
    	'term' => 'fan-comments',
    	'post_type' => 'fan',
    	'posts_per_page' => 8
    	);
    	$comments = new WP_Query($args);
        if($comments->have_posts()) : while($comments->have_posts()) :
    	$comments->the_post(); ?>
    
    Whatever you want to display goes here...
    
      <?php endwhile; endif; ?>
      <?php wp_reset_query(); // end Fan Cooments loop. ?>

    Let me know if you need any more info than that.

    Thread Starter flint_and_tinder

    (@flint_and_tinder)

    A-ha, I have solved it myself. Thanks anyway to anyone who reads this.

    Thread Starter flint_and_tinder

    (@flint_and_tinder)

    I assume if nobody has any ideas that I’ll have to set up a Custom Post Type and assign the pdfs to a post.

    Thread Starter flint_and_tinder

    (@flint_and_tinder)

    I don’t want to use the custom excerpt box though. I would like it to grab the content. Can I change something in here to bring the tags back in?

    $excerpt = preg_replace('\[[^\]]*\]','',$excerpt);

    Thread Starter flint_and_tinder

    (@flint_and_tinder)

    Haha! I’ve realised one bit where I’ve gone wrong. Thumbnails are working. Pseudo selector still isn’t though.

    Thread Starter flint_and_tinder

    (@flint_and_tinder)

    Thanks Keesiemeijer. Unfortunately that doesn’t seem to work for me. However a friend of mind has helped out and come up with the following so I can use the multi checkbox list in the meta box:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    Thread Starter flint_and_tinder

    (@flint_and_tinder)

    Thanks for your patience Keesiemeijer.

    At the moment I have set up three things in the metabox:

    1) A standard textarea
    2) A single stand-alone checkbox for the childcare term (see childcare_cb above)
    3) A set of multiple checkboxes that contain all the departments taxonomy terms (see departments array above).

    This was done because originally I set up number 3, but didn’t know how I could get the data from that to display the term posts lists.

    So I then set up a standalone checkbox for one of the terms (with the idea of creating more for all the other terms if I managed to get that one working) as I thought I would have a better idea of getting that to work.

    I don’t mind what option I have to use. If all the terms can stay in one multiple checkbox list, then great. If however I have to create standalone checkboxes for all the taxonomy terms that’s ok as well.

    If it helps, this is my current complete meta box code:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    Is that what you meant?

    Thread Starter flint_and_tinder

    (@flint_and_tinder)

    At the moment I have only set up the taxonomy for the People CPT not for the Services. The Services don’t need any Taxonomies because they are all stand alone Service pages.

    Thread Starter flint_and_tinder

    (@flint_and_tinder)

    Hi Keesiemeijer,

    Sorry I’m a designer by trade so I’ll try my best to answer your questions.

    To create the checkboxes, I used the meta box script over at Deluxe Blog tips:
    https://www.deluxeblogtips.com/meta-box-script-for-wordpress/
    with the actual checkbox created with this:

    array(
    'name' => 'Departments',
    'id' => $prefix . 'departments',
    'type' => 'taxonomy', // File type: taxonomy
    'options' => array(
    'taxonomy' => 'departments', // Taxonomy name
    'type' => 'checkbox_list',  // How to show taxonomy: 'checkbox_list' (default) or 'select'. Optional
    'args' => array(),          // Additional arguments for get_terms() function
    ),
    'desc' => 'Select which staff department lists you wish to display'

    I’m not sure how the data is saved.

    Another thing I have done is to create a standalone checkbox for one of the ‘Departments’ taxonomy terms called ‘childcare’ like so:

    array(
    'name' => 'Single Department',    // File type: checkbox
    'id' => $prefix . 'childcare_cb',
    'type' => 'checkbox',
    'desc' => 'Childcare',
    'std' => 0  // Value can be 0 or 1
    ),

    Using this and the following code in the template:

    <?php if( $childcare_cb = get_post_meta($post->ID, '_childcare_cb', true) ): ?>
    <ul>
    <li><?php echo $childcare_cb; ?></li>
    </ul>
    <?php else: ?>
    <?php endif; ?>

    I end up with something like this:

    ? 1

    Which I assume is listing the number of members members who I have assigned to the ‘chilcare’ term. This is a start, but ideally I need to display the title and a thumbnail for each of the staff members assigned to each department.

    Thread Starter flint_and_tinder

    (@flint_and_tinder)

    One option I’m working on is to set up multiple queries in the single-services template that checks to see if a checkbox is selected and if so, output a list of the posts. So far my code looks like this but it doesn’t work correctly:

    <?php if( $childcare_cb = get_post_meta($post->ID, '_childcare_cb', true) ): ?>
    <ul>
     <?php $query_hot = new WP_Query( array(
        'taxonomy' => 'departments',
        'field' => 'slug',// You can use the ID or slug here
    	'terms' => 'childcare'
    ));
    while($query_hot->have_posts()) : $query_hot->the_post(); ?>
    <li>
    	<a href="<?php the_permalink(); ?>"><?php the_title();?></a>
    </li>
    <?php endwhile; wp_reset_postdata(); // reset the query ?>
     </ul>
    <?php endif; ?>

    For some reason is it displaying a list of my standard posts (i.e. news items).

    Obviously if I went down this route I’d also have to set up a query for each one of the ‘Departments’ taxonomy tags which at current count is about 20. That’s fine if I can get it to work, but if anyone knows a more graceful solution I’d be incredibly grateful.

    Thread Starter flint_and_tinder

    (@flint_and_tinder)

    I’m not sure is this is relevant but the code above is all placed (and needs to work)within the page loop.

    Thread Starter flint_and_tinder

    (@flint_and_tinder)

    No probs I’ve done it. Just needed to remove the first echo:

    <?php
    	 $vht = $vd_option['vd_home_text'];
    	 echo wpautop($vht);
    	 ?>
    Thread Starter flint_and_tinder

    (@flint_and_tinder)

    Forgot to add that in the example above where I created a Videos page for the ‘projects’ to appear, that I had to delete the

    'rewrite' => array(
        		'slug' => 'videos'
      		),

    part of the functions code.

Viewing 15 replies - 16 through 30 (of 61 total)