Tag Info

New answers tagged

0

The problem was that the files wasn't attached to the post. To make it work I re-attached the files (Media Library > Attach). I also removed the & in $attachments =& get_children( array (.


0

First, WordPress does not offer any built-in solution to displaying posts of a specific post type and a specific taxonomy term. I'm talking about something like get_term_archive_link_for_post_type( $term, $post_type ) or so. So you have to do this yourself. Of course, you could create a page, name it Construction Projects, give it a new page template, in ...


0

There is an example in the WP Codex which should work for you: Try the following naming convention for your taxonomy term archive template: taxonomy-{taxonomy}-{term}.php So, let's say you have a CPT named "Projects," a taxonomy named "Maintenance," and a term within the taxonomy named "Professional." Then your naming convention would be: ...


2

Notice that you don't need echo to display the result, since echo=1 is the default settings of wp_get_archives(). As @PieterGoosen explained, the wp_get_archives() function doesn't support the exclude parameter. But we can use _exclude_terms, the custom parameter of the wp_get_archives() function, to exclude posts with some given terms. Here's an ...


1

Your code won't work as there are no exclude parameter in wp_get_archives(). Here is the list of valid parameters and their defaults <?php $args = array( 'type' => 'monthly', 'limit' => '', 'format' => 'html', 'before' => '', 'after' => '', 'show_post_count' => ...


0

Alright, I solved it: I queried the year and month of the page we're on with: $year = get_query_var('year'); $monthnum = get_query_var('monthnum'); And then I added date parameters to each WP_Query: $col1 = new WP_Query( array( 'year' => $year, 'monthnum' => ...


0

You could use template_redirect hook to redirect your pages, like this: function my_page_template_redirect() { global $wp_query; $object = $wp_query->get_queried_object(); //this returns queried object. Check the conditions and redirect } add_action('template_redirect', 'my_page_template_redirect');


1

You can use the pre_get_posts action to set posts_per_page to -1 on the monthly archive pages. I said wrongly in a comment to use is_archive() as your conditional. The problem with is_archive() is, it returns true on all archives, which includes category and taxonomy archive pages as well. I would suggest to make use of is_date() and is_month() if you ...


-2

<?php $oct_04 = get_month_link('2004', '10'); ?> explanation: 1) If year and month parameters are set to '', the tag returns the URL for the current month's archive. 2) Returns URL to the archive for October 2004, assigning it to the variable $oct_04. The variable can then be used elsewhere in a page.


0

Your English isn't clear to me. What I understood is that you want to list archives of posts with specifications. Like, posts from the first week January, year 2013. Well, there is a dedicated function for this purpose and it's: wp_get_archives(); For example, if you want posts of the first week of January, year 2013: $args = array( 'type' => ...



Top 50 recent answers are included