sdaponte
Forum Replies Created
-
Forum: Plugins
In reply to: [Post Types Order] Sort not working on SOME custom post typesThanks tdgu – I had read on some other forum responses that setting the hierarchical setting to false did the trick for most people, however my custom post type is already specifying a non-hierarchical relationship, so specifying it here again is in fact redundant. That being said switching it to true, or removing it entirely both had no affect.
nsp-code: Not sure where this autosort you speak of is set? Would this be a setting in the custom post type or is this an argument I can pass within my query? If so can you let me know what the proper syntax is? I’ve tried ‘autosort’=>false and ‘auto_sort’ => false
In re. to your suggestion about plugins – the only 3 plugins I’m using are Types, Post Types Order, and Contact Form 7.
Forum: Plugins
In reply to: [Post Types Order] Sort not working on SOME custom post typesThanks for the response – unfortunately that did not make any change.
I’ve actually tried every option for the orderby:
http://codex.ww.wp.xz.cn/Class_Reference/WP_Query#Order_.26_Orderby_Parameters
Section 5.11None of which seemed to have any affect on the ordering.
Forum: Plugins
In reply to: [Post Types Order] Sort not working on SOME custom post typesREVISION:
It appears the sort is somewhat working, but is behaving strangely. Again, my homepage_billboards custom type is working exactly as expected. I have two other post types that are behaving differently.
I have my items sorted as so:
(1)Lorem
(2)Ipsum
(3)DolorAnd they appear on my site as follows:
(3)Dolor
(1)Lorem
(2)IpsumAlso, if I change my ‘order’ from ‘ASC’ to ‘DESC’ it has no affect.
Forum: Plugins
In reply to: [Post Types Order] Orders in Backend but not frontendI’m having the same problem. Auto sort and Admin sort are both set, and my custom post type is non-hierarchical. I have his working for some custom post types, but not others.
I’ve tried every ‘orderby’ option on the codex page nsp-code suggested page (Section 5.11) and none of them seem to make a difference.<?php $args = array( 'post_type' => 'mde_fact', 'posts_per_page' => 5, 'orderby' => 'ID', 'order'=>'ASC', 'hierarchical' => false); $loop = new WP_Query( $args );Forum: Themes and Templates
In reply to: Applying templates to custom post types“or do they just need to be there because wordpress requires all kinds of extra junk to make things work”
Yes, very much so. I’m not really sure what they’re doing either to be honest, but if you remove that array it doesn’t display anything.
Forum: Themes and Templates
In reply to: Applying templates to custom post typesTake a look at the link I posted in the second post re: that part I told you to Google.
Forum: Themes and Templates
In reply to: Applying templates to custom post typesHey db9429!
Yes, this was from an old project, but I can still try to help you if I can.
For each custom post type you will need 2 templates – 1 (television.php) that will spit out the list of articles for that post type, and 1 (single-television.php) that will spit out the entire article. My custom post type was called ‘television’ for the client’s tv appearances.
So for the television.php, right under the opening php tag, you have to include a comment that names the template according to the name of your custom post type, like so:
/*
Template Name: Television
*/This will allow you to go into the page that you’ve created to list your articles and select the template name that you’ve just created. Then I did the following:
<?php <!--begin loop - select the post type by name--> query_posts( array( 'post_type' => 'television', order_by => 'meta_value&meta_key=date', order => 'desc') ); if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <!--output the content--> <p><a href = '<?php the_permalink(); ?>'><h2><?php the_title(); ?></h2></a> <strong><?php echo(types_render_field("show", array("arg1"=>"val1","arg2"=>"val2"))); ?></strong><br /> <?php echo(types_render_field("date", array("arg1"=>"val1","arg2"=>"val2"))); ?></p> <?php endwhile; endif; wp_reset_query(); ?>Now on the single-television.php, I did the following:
<?php while ( have_posts() ) : the_post(); ?> <!--Video Type--> <h2>Field One <?php echo(types_render_field("fieldOne", array("arg1"=>"val1","arg2"=>"val2"))); ?></h2> <strong>Field Two: </strong><?php echo(types_render_field("field-two", array("arg1"=>"val1","arg2"=>"val2"))); ?><br /> <!--Video Content--> <?php get_template_part( 'content', 'single' ); ?> <?php // If comments are open or we have at least one comment, load up the comment template if ( comments_open() || '0' != get_comments_number() ) comments_template( '', true ); ?> <?php endwhile; // end of the loop. ?>Unfortunately I don’t remember how I linked the appropriate single template type to the corresponding post type. I don’t believe this was done in the same way with the comment at the top of the file. Might have to do some googling for this one.
So in summary, you want to create a loop `<?php
query_posts( array( ‘post_type’ => ‘television’, order_by => ‘meta_value&meta_key=date’, order => ‘desc’) );
if ( have_posts() ) : while ( have_posts() ) : the_post();
?>that make sure you have posts to display and to reference the custom post type by name. If you want to output any fields, you use this line of code:<?php echo(types_render_field(“field-name”, array(“arg1″=>”val1″,”arg2″=>”val2”))); ?>` and just replace field-name with your field name.Hope this helps!
Forum: Themes and Templates
In reply to: Applying templates to custom post typesSorry? Is there something I can help you with?
Update:
I realized that I have to click the “Save All Changes” button in order for the alt text to take affect. In my media library now, the alternate text is displaying as I want it to, but in the markup the alt text is still just the url of the image. What is going on!?Forum: Plugins
In reply to: get_page and get_pages conflictsSo as per usual, by solving one problem, I’ve created another.
at the end of my feature-page I’ve set $post and $page to empty strings, and am able to display the first child of my about section
About
– About us (which is displaying in about)
– management teamThis is the other section where this will be applicable:
Contact
– Office locations (which I want to display)
– Contact formHowever, the contact page is displaying the About Us page as well, which makes no sense to me since I’m not using a page id to grab that page.
The code for the pull-child-page has remained exactly the same, except I’ve removed some extra parameters in the first line:
$pages = get_pages('child_of='.$page->ID);
So it now looks like this.This is driving me crazy! Any help is greatly appreciated!!
Forum: Fixing WordPress
In reply to: Navigation clause where menu_order is greater than nThanks esmi!
What I ended up doing instead of by order, I set the top navigation to display only top-level items and not it’s children:
<?php wp_nav_menu( array( ‘theme_location’ => ‘primary’, ‘depth’ => 1,) ); ?>
Forum: Fixing WordPress
In reply to: Navigation clause where menu_order is greater than nThanks esmi, how would I go about making that callback? If you can provide me with a link or just how I would add the condition in the function call I would really appreciate it 🙂
Forum: Fixing WordPress
In reply to: Sort by custom date fieldSorry, I should have been more clear.
I’m using custom post types, and by extension using a custom date field.
I don’t want to display the date that the post was created, but the custom date that the field specifies, since the client is backlogging pre-existing articles.Thanks for your response and thanks in advance to anyone else who can offer help!
Forum: Fixing WordPress
In reply to: Custom Post Type display on homepageOh derp, I had done if (get_post_type($post->ID) != “television” && get_post_type($post->ID) != “writing”), but if I wanted to add more custom post types in the future that was probably the better solution.
Thanks very much!Forum: Fixing WordPress
In reply to: Custom Post Type display on homepageHey bcworkz, thanks a lot for the help! It did exactly what I wanted.
My next question: how do I display only posts that do not belong to a custom post type in another section of the page?