Forum Replies Created

Viewing 12 replies - 46 through 57 (of 57 total)
  • Forum: Themes and Templates
    In reply to: Unexpected '

    This is the code from footer.php up to and including line 13. Does this help?

    <?php
    /**
     * The template for displaying the footer.
     *
     * Contains the closing of the id=main div and all content after
     *
     * @package WordPress
     * @subpackage Twenty_Eleven
     * @since Twenty Eleven 1.0
     */
    ?>
    
    	</div><!-- #main -->

    Thread Starter nprior

    (@nprior)

    I’ve just tried out sorting, filtering and bulk edit – looks great! It makes working on a catalog so much less frustrating. I like the way the more/less links on the quick edit select boxes work too. For a new recording I have over 100 Works to select from so being able to expand the list is a good thing.

    Good work!

    If you wanted a further challenge …

    How about some functionality that presents only relevant taxonomy names?

    I have a hierarchy of say Works – Movements – Recordings. All are custom post types, Works and Movements are CPT-onomies.

    When I create a new Recording, I assign one (or more) Works from the list, then I may optionally assign one or more Movements. At the moment all the Movements are displayed. It would be good to see only those Movements that have previously been attached to the current Work.

    I could see this sort of thing being valuable any time you have a strict one-to-many hierarchy and you want to enforce a degree of data integrity. It would mean you could lock down your taxonomies and protect the data structure from your users!!

    I could see it working like this:
    Create a new recording. The Works list is fully populated so go and select one. As soon as you have selected one, the Movements list is populated by the Movements that are assigned to the Work. Select one and you’re done.

    Obviously it wouldn’t work if there wasn’t a strict one-to-many hierarchy between taxonomies. It wouldn’t work for Films – Actors for example. It could work for Books – Chapters – Illustrations, or Author – Books – Editions.

    Make the posts you want to have appear Sticky posts

    Thread Starter nprior

    (@nprior)

    Brilliant – look forward to giving it a spin!

    Thread Starter nprior

    (@nprior)

    Much neater – thank you

    Thread Starter nprior

    (@nprior)

    Fantastic! Thanks Rachel.

    This plugin solves something I started to build about 12 months ago and stopped because it was too difficult to give to someone to maintain. Recognise the story?!!

    Its plugins like yours really make WordPress into far more than just a blogging tool.

    Thread Starter nprior

    (@nprior)

    Well, I have a solution but it’s not very elegant…. Would appreciate a view on the use of CPT-onomies with the tax_query array for WP_query.

    <?php
    // The Query
    $args = array('post_type' => 'scores')  ;
    $the_query = new WP_Query ($args);
    // The Loop
    while ( $the_query->have_posts() ) : $the_query->the_post();
    $terms = wp_get_object_terms( $post->ID, 'works' );
    if ( $terms && !is_wp_error( $terms ) ) {
       foreach ( $terms as $term ) {
          if ($current_work==$term->name) {
    	      echo '<li>';
                  the_title();
    	      the_content();
    	      echo '</li>';
       		}
    	}
    }
    endwhile;
    // Reset Post Data
    wp_reset_postdata();
    ?>
    Thread Starter nprior

    (@nprior)

    Oops! It would help if I passed the $args, wouldn’t it? Code as follows:

    <?php $current_work = get_the_title(); ?>
    <?php echo "<h3>Scores</h3>"; ?>
    <?php
    $args = array('post_type' => 'scores',
                  'tax_query' => array (
                   array ( 'taxonomy' => 'works',
    		       'field'    => 'slug',
    		       'terms'    => $current_work)));
    $the_query = new WP_Query ($args);
    while ( $the_query->have_posts() ) : $the_query->the_post();
    	the_content();
    endwhile;
    wp_reset_postdata();
    ?>

    But still no joy from this – any thoughts?

    Thread Starter nprior

    (@nprior)

    THat did it! I had already saved the set up, but I went back in, changedf the value of the Button Size field (it was already defaulting to 100% in the field) to 24×24, and away we go!

    Many thanks for that.

    Thread Starter nprior

    (@nprior)

    Problem solved – URL removed

    thanks
    Nick

    Thread Starter nprior

    (@nprior)

    Here’s a variation on Fernando Briano’s List Category Posts plugin. replace his original code with this snippet – should be obvious where it goes:

    function list_category_posts($atts){
    	if($atts['name']!='default' && $atts['id']=='0'){
    		$category = 'category_name=' . $atts['name'];
    		$category_id = get_cat_ID($atts['name']);
    	}else{
                    $mycats = array();
                    $mycats=explode(',',$atts['id']);
                    for ($i=count($mycats)-1; $i>=0;--$i){$mycats[$i]=(int)$mycats[$i];}
                    $mycats=array_filter($mycats);
                    $mycats=array_values($mycats);
     	}
    
    	//Build the query for get_posts()
    	$catposts = get_posts(array(
             'category__and' => $mycats,
             'orderby'       => $atts['orderby'],
             'order'         => $atts['order'],
             'numberposts'   => $atts['numberposts'],
             'excerpt'       => $atts['excerpt'],
             ) );

    Then use it like this in a post:
    [catlist id=49,14 numberposts=-1 orderby=title]

    Thread Starter nprior

    (@nprior)

    Pods CMS

Viewing 12 replies - 46 through 57 (of 57 total)