specialmachine
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Listing specific page by slugFor anyone’s future reference, the code works in both manners as you would assume…
<?php $args=array( 'orderby' =>'parent', 'tag_slug__in' => array('food','cocktails','wine'), 'order' =>'asc', 'post_type' =>'page' ); $page_query = new WP_Query($args); ?> <?php while ($page_query->have_posts()) : $page_query->the_post(); ?> <div class="teaser"> <h2><a href="<?php the_permalink();?>"><?php the_title();?></a></h2> <?php the_excerpt(); ?> </div> <?php endwhile; ?>
or…
<?php $args=array( 'orderby' =>'parent', 'tag_slug__in' => array('menu'), 'order' =>'asc', 'post_type' =>'page' ); $page_query = new WP_Query($args); ?> <?php while ($page_query->have_posts()) : $page_query->the_post(); ?> <div class="teaser"> <h2><a href="<?php the_permalink();?>"><?php the_title();?></a></h2> <?php the_excerpt(); ?> </div> <?php endwhile; ?>
So, a nice use for this code could be displaying pages in a single template, like if you have a menu with three sections (food, cocktails, wine). So you can tag them all “menu” and use just that tag in the code, or you can control the order in an arbitrary way by listing the tags in the array.
Thank you again to Hakkim. I’m really happy to know there are kind people out there, willing to help. It’s really cool.
Forum: Fixing WordPress
In reply to: Listing specific page by slugBoom! That works! THANK YOU! Now I have two very useful bits of code. Lots of love from Germany, Hakkim!
Forum: Fixing WordPress
In reply to: Listing specific page by slugAh, just saw your new post. I’ll try it.
Forum: Fixing WordPress
In reply to: Listing specific page by slugIn this case, would it be looking for a page that is tagged, ‘essen’, and ‘trinken’ and ‘wein’?
Sorry. I’ve realized I can just tag all three pages with ‘menu’ and as they are set to order anyway, it really achieves what I’m after.
That said, ideally, it would be great to be able to have an arbitrary order for design purposes. But this achieves what I’m after, so I do thank you. The reason I was after a way to display pages by slug was so I could just list them in the order I wanted them to appear, along with not having to fuss over an ID as they are often if ever in sync unless the databases are exactly the same between what’s online and my local machine where I build the sites.
So thank you for your help. We can leave it there if you like. Perhaps some day I’ll achieve my dream. ??
Forum: Fixing WordPress
In reply to: Listing specific page by slugThanks for sticking with me, Hakkim. I really appreciate it.
This is currently the code I’m using, after having removed the comma after ‘post_type’ =>’page’
It seems to only work with a single tag. If I add more than one, it stops working and nothing displays, although it doesn’t break the page.
<?php $args=array( 'orderby' =>'parent', 'tag' => 'essen+trinken+wein', 'order' =>'asc', 'post_type' =>'page' ); query_posts($args); $page_query = new WP_Query($args); ?> <?php while ($page_query->have_posts()) : $page_query->the_post(); ?> <div class="teaser"> <h2><a href="<?php the_permalink();?>"><?php the_title();?></a></h2> <?php the_excerpt(); ?> </div> <?php endwhile; ?>
Forum: Fixing WordPress
In reply to: Listing specific page by slugSorry, I was using this….
<?php $args=array( 'orderby' =>'parent', 'tag' => 'essen+trinken+wein', 'order' =>'asc', 'post_type' =>'page', ); query_posts($args); $page_query = new WP_Query($args); ?> <?php while ($page_query->have_posts()) : $page_query->the_post(); ?> <div class="teaser"> <h2><a href="<?php the_permalink();?>"><?php the_title();?></a></h2> <?php the_excerpt(); ?> </div> <?php endwhile; ?>
Forum: Fixing WordPress
In reply to: Listing specific page by slugOkay, I enabled tagging for pages by grabbing some code here and slapping it in my functions.php. I tagged each page with the corresponding name, so just like the slug names. Then I tried to add in your code with the updates to the tag names and it broke the page. Again, lack of understanding for how this works. Sorry. This is the code i’m trying to use now…
<?php $args=array( 'orderby' =>'parent', 'tag' => 'food+cocktails+wine', 'order' =>'asc', 'post_type' =>'page', ); query_posts($args); ?> <?php while ($page_query->have_posts()) : $page_query->the_post(); ?> <div class="teaser"> <h2><a href="<?php the_permalink();?>"><?php the_title();?></a></h2> <?php the_excerpt(); ?> </div> <?php endwhile; ?>
Forum: Fixing WordPress
In reply to: Listing specific page by slugHi Hakkim – I really don’t know how to do any of this. I’m not a developer. I know what I’m after, and then when it comes to how to do it, I just scour the web looking for a snippet of code.
Forum: Fixing WordPress
In reply to: Listing specific page by slugYes, wonderful – I can do it with one slug, but I’m after multiple slugs. Perhaps I’m just not doing that part right as this code breaks the page…
<?php $the_slug = 'food', 'cocktails', 'wine'; $args=array( 'orderby' =>'parent', 'name' => $the_slug, 'order' =>'asc', 'post_type' =>'page', ); $page_query = new WP_Query($args); ?> <?php while ($page_query->have_posts()) : $page_query->the_post(); ?> <div class="teaser"> <h2><a href="<?php the_permalink();?>"><?php the_title();?></a></h2> <?php the_excerpt(); ?> </div> <?php endwhile; ?>
Forum: Plugins
In reply to: [Plugin: Official Facebook Plugin]I found some documentation. I guess I just have to bite the bullet. Arrghghg.
Forum: Fixing WordPress
In reply to: site navigation not workingDo you have a url?
Forum: Fixing WordPress
In reply to: Exclude categories by slug in twentytwelve_entry_metaI really appreciate your trying. I did trying to adapt the other code to this, but had no luck myself.
Forum: Fixing WordPress
In reply to: Exclude categories by slug in twentytwelve_entry_metaI’ve even excluded “uncategorized” (or “Uncategorized” if it’s the category name version) so that is why there are no categories at all. There are only three categories in total at the moment, and I don’t want any of them to display. As I add posts, I will add additional categories, obviously, and each of the existing posts will get some category that will display as well, but it’s good that this popped up like this as it shows there’s a bug when there is no category assigned (other than “uncategorized”).
Forum: Fixing WordPress
In reply to: Exclude categories by slug in twentytwelve_entry_metaSorry it’s only local at the moment.
I created a child theme of Twenty Twelve with no changes to this particular function that displays the meta entry at the footer of the post, both in the index.php and single.php, other than the code we have both posted in this thread. Each result is the result of using that code independently – I am using either the snippet I posted, or yours. Not both at the same time.
Here are the differences…
***
This entry was posted on 3. June 2013.
This entry was posted in , on 3. June 2013.
***
The first is a result of using the category name code. The second is the result of your snippet. You can see in the first result, the default behavior coded into the twentytwelve_entry_meta function kicks in so what’s displayed is tidy in the absence of a category.
Forum: Fixing WordPress
In reply to: Exclude categories by slug in twentytwelve_entry_metaVery nearly. I really appreciate the effort. You can see how its behaving here with these two screens. One is using the category names, which is the first screen capture, and the second is using your code. The former displays a tidy category free version when there are no categories present as all three of the existing categories have been excluded.