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?
- WordPress Multisite – global categories
- Retrieve Product category ‘NAME’ by product category ID – WooCommerce?
- Can’t custom taxonomies have same terms (slugs) as categories?
- Using wp_category_checklist in a widget
- Activate Gutenberg in category-descriptions
- How to show subcategories in categories else show posts
- How would I increase the Author Role to be able to add a new category?
- How to remove the parentheses from the category widget
- Filter front page posts by category
- Exclude one category from get_the_term_list
- WordPress remove separator from last item in wp_list_categories
- Need help adding custom field to category
- How to: 301 Redirect /category/ to /customname/
- How to Include the Parent and Child Category in the Permalink if the Post is Added to Both
- Custom Query to search through categories
- Root level category, tag, author and archive pages to work
- Number of posts in page – set per category and exclude sidebar
- Get sticky post from category?
- Display one latest post from multiple categories
- Archive pagination causing 404 with permalinks structure
- Use get_term_children to get the sub category of a parent category for the current post
- Get a list of Terms for a specific category
- Get a variable from object in array [closed]
- How to stop wordpress from showing the selected category on top of others in the category selection?
- Remove Archive Headline and Archive Intro Text fields on category and tag archive pages in WordPress Admin with Genesis framework
- advanced custom field Show field in special categry page [closed]
- How Do I Merge Categories With phpMyAdmin
- Exclude Child Categories Using wp_list_categories
- Show category children, one level
- a-z list, categories and sub categories in loop
- Category slug $_SERVER[‘REQUEST_URI’];
- wp_dropdown_categories and custom taxonomy + custom post type
- How do I get a list of all categories that a given user has written blog posts for?
- Random taxonomy category list
- Linking products to categories
- How to remove “Category : …”
- Multiple Domain Names – One WP Install (non-Multisite) – Default Each Domain name to Product Category WooCommerce
- Show all posts for a specific category/author
- Add “page-a” slug to category link if user visit category link from “page-a”
- Resort get_categories
- Query Posts Exclude Entire Category
- One Specific Category To Permalink
- Hide woocommerce category name from specific pages
- select parent category first then child
- WordPress category widget only show categories with children
- The arrangement of categories always change while posting article
- Woocommerce custom category page with pagination [closed]
- Menus don’t work after 4.4 [closed]
- Custom post and category template pagination problem