Tag Info

Hot answers tagged

3

You don't, archive-post.php doesn't exist, it's just archive.php, and on most sites the post archive is the root of the site, aka /. Depending on how you're viewing posts it'll use home.php, front-page.php, index.php, etc. You should refer to the template hierarchy diagram, but remember, the standard post post type is a special case, as are pages Perhaps ...


2

If this is a true page, then you can get the ID of that specific page with get_queried_object_id(). This works and will return the ID on the specific pages, single, category, taxonomy, tag and author pages where it is used. True date and time archives and the homepage will not have ID's You can do the following $page_id = get_queried_object_id(); echo ...


2

Do you really need to know the ID, for that see @PieterGoosens's answer, or do you just need to know if you are at the post type product archive? The latter can easily be achieved by using is_post_type_archive(): if ( is_post_type_archive( 'product' ) ) { // code }


2

There was a new function introduced in Wordpress 4.1 called the_archive_title() which does just that. You can simply add the_archive_title() in your archive page. If you need to filter the output, see my answer here on how to accomplish that


2

Custom post type archive page does not need "dumb" Page. In fact, there could be the culprit. You should try this: Remove /* Template Name: Staff */ from archive-staff_member.php (not needed) Remove "dumb" stuff Page (if created). There could be some permalink conflict. Go to Admin > Settings > Permalinks and re-save it (it will regenerate rewrite rules) ...


2

You can change it via the category template (if you have multiple category templates you'll need to edit all of them; if you have archive.php, you need to edit it only there). Otherwise you can use the Yoast SEO plugin which have settings for naming the archives (actually I think that almost all SEO plugins have those settings).


1

You're right. It isn't a good structure. You are running three queries on the page-- the two you are creating plus the main query that is being completely ignored (plus ancillary queries). You are also clobbering the main query halfway through the page load when you overwrite $wp_query, which can cause unexpected and unpredictable results and difficulty ...


1

Permalinks or the pretty url of your posts be set under permalink in settings. there you can use %hour% or many other available tags in your url


1

I don't suspect that your tax_query is failing you, but actually your tag parameter is. single_tag_title() returns the name of the tag, not the slug. All tag and category queries are converted to a tax_query in the WP_Query class before being passed to the WP_Tax_Query class to build the relative string for the SQL query. Term names and slugs gets ...



Only top voted, non community-wiki answers of a minimum length are eligible