whether a template can be provided for index.php?
There’s no built-in capability for selecting a custom template for archives.
How can i provide option for full width, sidebarleft& sidebarright options for index.php?
You can add a generic Customizer control with options for which template to use for archives, then inside index.php you would just check the saved value of that control with get_theme_mod()
and change the template accordingly, or include another template file, for example:
switch ( get_theme_mod( 'layout' ) ) {
case 'fullwidth':
get_template_part( 'index', 'fullwidth' );
break;
case 'sidebarleft':
get_template_part( 'index', 'sidebarleft' );
break;
case 'sidebarright':
get_template_part( 'index', 'sidebarright' );
break;
}
Related Posts:
- How to move page templates to custom folder?
- Is it possible to manipulate the list of page templates?
- Returning Variables back into a template
- Where can I access my custom page template?
- Disable front-page.php template
- Single Page theme [closed]
- Move default page templates to sub directory
- Load sidebar template just once to prevent multiple animations
- Need help with adding templates (archives and sitemap) to WordPress child theme
- Templates dropdown not appearing using _s theme (underscores)
- How to show children pages as array
- Create a variable with string, array or multiple values
- What is the point of using the front-page.php template? [closed]
- Custom single template for a specific category
- How to insert a logo in the header?
- Page template in two level deep folder
- Create “File-less” Page Template in Functions.php
- How does WordPress decide what template to use as frontpage
- How can I get wp_head() as a string instead of echoing it?
- Why does my short code get executed before other content?
- How can I see what template parts are being called for rendering the viewable page?
- Problems with Layout inherit in theme.json
- How to Handle CSS for Multiple Header header.php Files?
- Static Front Page problem
- Pagination & get_pages?
- Can not Remove Archives and Meta from Sidebar
- How to override BuddyPress 3.0 bp-nouveau theme files?
- Setting hero/splash section as a blog post
- Where is the correct place(s) in twentysixteen’s header.php to add a Google webfont?
- How to retrieve an image from a post and display it before excerpt of a post? [duplicate]
- How do I update WooCommerce template files in my theme? [closed]
- Page template across themes
- New template, where to place CSS?
- Check if password protected post is visible
- get_query_var() and permalinks
- What is the best way to handle multiple calls to get_template_directory_uri() and similar functions?
- Toggle Sidebar Display
- Add theme templates for child categories into the template hierarchy
- Move theme templates to subfolder without losing page associations
- Theme development question regarding layouts
- Why are theme templates organized as multiple point of entry PHP files instead of reusing your theme’s index.php?
- WordPress page templates in a directory
- How do I create a custom partial / template?
- Can I show all the template files that are being used on my site?
- Change the template of multiple multisite pages at the same time
- Load child template based on parent
- Multiple Page Templates & CSS
- How to enable template page only for a post id page
- Can Page Templates be Applied to Archive and Post Templates?
- Why is the Page Template dropdown menu using the wrong file name?
- Single page site with history.js
- Do i need to keep all the default WP templates files in a theme?
- how to display search term in the template full site editor
- How to create a custom page(not a template) in a theme
- Sort wp_query by sum of two meta fields
- How to override p2 breathe theme plugin in content template file?
- What can I use for small text when converting to WordPress?
- how to setup custom content structures
- How can I conditionally show different home page templates based on whether or not the user is logged in?
- How to create a template for Pages?
- Is there any tool to find lines of codes responsible to generate front-end HTML elements?
- How do I get the trackback count of a post in wordpress without writing an SQL query?
- Unique design inside a specific category’s url
- Why in the static pages of my theme are showing these information?
- Broken theme, template is missing
- How to add menù section to my WordPress template?
- Modify available templates (in dropdown)
- How to add custom meta box when you have a custom page template file
- Password protect a custom template
- Shortcode call not working in WP Template
- Load different single.php templates according to post layout selection
- Create theme for mobile phones and tablets only?
- Confused by the behaviour of “front page” / “home” templates
- I need to develop a one-page design
- How to create a WP theme that use BootStrap? [closed]
- How to link to the page displayed by home.php?
- How to use shortcode inside of shortcode in theme
- Under theme folder, what’s sequence of action for index.php, page.php, single.php?
- How to differentiate the homepage structure from the category page structure in WordPress template?
- Is there a template tag I can use to link to the archive page corresponding to the month that a post was published on?
- ACF get_sub_field ALT TAG in the repeater doesn’t show
- A Reviews Page is Showing root Index.php instead of Template-Page
- No templates for condition page.php Elementor
- Show Yoast SEO meta tags in Custom WordPress Templates (Theme)
- How to show metabox on page if it is using a template
- Using wp_add_inline_style Inside a Template File
- Different templates for each category level
- Problem with Displaying Custom Theme Page’s Content
- Child theme in separate WordPress Install
- Different stylesheet for different pages not working fully
- Why WordPress gets old templates code instead of the last updated ones
- Can you create a custom page with content in the center already defined?
- Enable WP to accept standard jQuery code embeding between the tags [duplicate]
- Loop inside page template not working
- Best practice to create required pages
- How to split the site’s layout without damaging this layout? [closed]
- Is there a way to have WordPress autodetect page templates in the page-templates directory and any sub-folders?
- What is the point of using archive.php instead of index.php?
- Theme template file for a specific custom taxonomy
- How to automatically set a Template Page Name next to a page in menu screen such as WooCommerce pages, front page, or posts page in wordpress?