I don’t know what our single-XXX.php
files look like, but if they include calls to get_header
(and perhaps get_sidebar()
and get_footer
) you obviously will get the header twice as it is called again at the bottom of your first code block (and perhaps te rest of the regular page).
In the second code block you avoid outputting the header twice, because it is in the final else statement, but if there is more code below it will still be executed after the call to single-XXX.php
. You should make sure the whole code of the regular single page is inside the else
statement.
Otherwise, you could make a template called single-normal
, place the full code there and replace the line else get_header();
in your last code block with else get_template_part('single', 'normal');
.
Related Posts:
- Check if current category has subcategories
- wp_nav_menu not appearing for a couple pages
- wp_update_nav_menu_item() to insert categories
- How to get the url to tag & category base set by the user?
- Why adding Categories does not auto refresh in Backend while using my custom theme?
- is_archive() content being shown instead of is_category()
- Retrieve all posts within tag OR category?
- Edit the markup of categories list
- New Theme creation
- How to get data about category in category.php
- editing fonts of category links from the_category() funtion
- How to check category of of custom post type or not
- Set a them for all subset of category
- How to call custom category field data in theme?
- Different templates for different category tags
- Why category.php throw 404 in wordpress while calling paginate_links()?
- Woo Framework: woo_cat_featured not populating
- Inside a loop, how to change CSS class based on category name?
- Question on using custom structures for categories
- Getting the category title / description returns first matching post?
- Allow user to select categories that will display in post loop
- Insert HTML content in WP Query at specific point
- How do I retrieve the category ID (ugly permalinks) in my sub-navigation menu?
- Category page returns 404 error
- Show post categories
- Add description to categories menu in admin
- filter a loop base on specific category
- Problem with multiple loops in wordpress theme
- How to add icon over specific thumb
- How to differentiate the homepage structure from the category page structure in WordPress template?
- How to detect /category and /tag base pages?
- WooCommerce shared categories
- Show the number of the post
- Products category search not working
- In if…else condition, the else statement shows even if if statement is correct
- Can’t display posts by filtering categories using isotope.js
- Media Library Categories
- How can I add HTML classes for current taxonomy/term hierarchy into my pages to simplify styles?
- Show posts from all categories
- If it is a top level category show children otherwise show sibling categories
- Lowest catagory link
- How to get multiple loop in category.php, my scripts becomes madness
- Category base 404 – fix
- altering theme – content generated by PAGES not PORTFOLIO
- Category Archives: Show posts categorized in parent category only
- WordPress 3.5 how to determine if user is on category listing or category edit screen?
- Display only one level subcategory in wordpress
- How can i hide the authors box from a specific set of categories and post types?
- Get all first images of posts in same category
- How to display the category featured images [closed]
- How to make /category/ URL load properly instead of 404 error?
- Could not insert term into the database
- Activate Gutenberg in category-descriptions
- How would I increase the Author Role to be able to add a new category?
- Only show category to certain user levels without plugin
- How to: 301 Redirect /category/ to /customname/
- Custom Query to search through categories
- Get sticky post from category?
- Remove Archive Headline and Archive Intro Text fields on category and tag archive pages in WordPress Admin with Genesis framework
- How Do I Merge Categories With phpMyAdmin
- Display name of the last child category
- Show category children, one level
- Viewing category pages without the word ‘category’ in URL
- Random taxonomy category list
- how to change template?
- Multiple Domain Names – One WP Install (non-Multisite) – Default Each Domain name to Product Category WooCommerce
- Show all posts for a specific category/author
- Hard coded main navigation
- Resort get_categories
- The arrangement of categories always change while posting article
- Archieve.php not loading for custom post type
- Limit categories and it’s subcategories for specific group of users
- Admin: Navigation Menus do not show empty categories/taxonomies in the list’s search tab
- getting post data in functions.php
- Category specific order
- Remove the number of posts displayed in wp_list_categories()
- “Virtual category page” based on a custom field filter
- Rebuilding a Site: How to Show Several Category Posts in Woo Framework Theme?
- Get categories related to particular category
- Displaying links to all posts of the same category on the post page
- handling the featured category
- create relationship between posts from one category and posts from another category
- Intermittent Gutenberg 504 Gateway Timeout when calling REST route to retrieve categories
- display specific category when website loads
- Excluding current category from sidebar’s post widget, elementor, query-id
- OK to redirect the root WordPress category slug?
- Show subChild categories
- WooCommerce REST API not returning the default products category
- Include a page’s “category” in its URL
- Excluding specific category from custom theme functions
- Using the slug of a custom post category as prefix for the underlying custom post slugs
- Change background image page header overlay for each category
- List non-empty categories from a custom post type
- Issue with WordPress category search
- WordPress Category url redirects to subdomain
- Code to display category-specific single.php is overriding normal single.php, too
- Media Library filter returns undefined function get_current_screen
- Custom built theme won’t filter categories
- get IDs from links categories
- Display all subcategories for a product category in woocommerce