Wordpress Select Template for Each Page on Activation - php

So, I have wordpress multisite. I want my users to be able to activate a new theme, and still have their content in place. The problem I am having is, everytime a new theme is activated, each page's template selection is updated to the 'default' template. I would like for example, the Home Page to keep the home-page.php template etc... I have tried naming the templates in all the themes the same.. but that did not work.
Am i clear? or do I need to explain more? Is this possible?

Firstly take backup of all your WordPress data in .xml file
situated at example.com/wp-admin->Tools->Export
you also customize your new theme in custom tab, there you can access all the previous data from older theme

Related

Add php/html file to Wordpress Themes

I am new on wordpress and are using the themes as well. May I know where do I put a new file if let say main.php? I want to make a custom main page and replace the index.php page on the theme. Do I need to put it under htdocs\wordpress\wp-content\themes\<theme-name>. I am using this locally on my computer.
On my main.php, I also include css file. Where do I insert the css file as well?
you can set your front page in wordpress dashboard customization options
Go to Administration > Settings > Reading panel.
and select the page listing in dropdown , but before that you have to create a new page and select you custom page from dropdown . see the below image.
refer this for more info
you can have your css file keep on style directory of your theme and link it in your main page using
get_template_directory_uri() . '/styles/your-style-file.css'
You have to create page template for this.
Have a look over below thread hope this will help you
https://developer.wordpress.org/themes/template-files-section/page-template-files/page-templates/

How to make Wordpress Custom page

i m a newbie to wordpress. I have started theme development and encountered these problems. I think these kind of problem does have a solution, but i m not able to find it out.
I m trying to make a custom page. Uptill now i have made header, footer and main index page.
I see that whenever my theme is activated, I see these default index page, with header and footer assign to it.
I have also made some cutom about us , contact us pages using the Add Pages Functionality of wordpress.
My Problem:
1.Now I m trying to make custom product page where I will have more than 100 images on that pages, and then i can change the images, add the images and description and the link url in future. I have made some html code and put it in the text Tab . I can also see the images on the frontend of the Custom page. But my template breaks. Images goes up and description goes far below.
Also i wanted to add fancybox to all the images which are goin to be replaced or added. But again my template breaks.
So can we make custom.php page and do some coding or anything which you feel is the right way of doing it, Please let me know.
Firstly create product.php page in templates folder using below code on top
<?php
/*
Template Name: My Product Page
*/
get_header();
// write your code here
get_footer();
Then, assign the above template to the page in admin.
Then, that page you can call in menu.
For more detail, check here :- http://codex.wordpress.org/Page_Templates
Actually you don't really need to create a custom template for this unless if you are planing to use that same template on another page.
If your page name is products , just create a file called page-products.php in your theme root. and write your code inside that page.
If your planing to develop themes first be comfirtable with wp template hierarchy.
http://codex.wordpress.org/Template_Hierarchy

Wordpress custom template doesn't show up for the rest of the world

I am trying to add a custom php page to my wordpress site. this page should be in plain text (no theme or other wordpress b*ullsh*t). So i created a new template in my theme folder, created a new page from wp administration page. Everything worked perfect. But when i logout and try to access to this page, it shows me just an empty wp template with no content in it. I checked that i made the page public.
what's wrong? why is wp showing two different pages for admins and the rest of the world ???
I feel stupid but the answer is very simple: the theme folder for admin and other users were actually different.

Apply theme based on user selection in Wordpress?

I have an idea to create a template sites that basically shows a different templates in web page. When user select particular template, The site should have changed to that theme selected by user at run time. Is there any plugin to change the theme dynamically in wordpress. If not kindly help how can we implement this ?
This plugin called theme preview basically does what you want. Instead of actually switching the theme, it will preview it for the user, so only the actual user is affected of the theme change and not the whole environment!

wordpress use in own template

I've created an HTML page as part of my website which I would like to use as a template for news articles. The page has all the things it needs, it just needs to display the correct news article in it.
I installed WordPress on my webserver and now wonder how I can have wordpress publish articles using my HTML page?
Is this even possible since WordPress works with php?
thanks
What you are talking about is themes. Wordpress allows you to create a theme for your installation so it displays using your html/css (more or less)
The way I do this is copy the default theme and make changes in there, and then you can switch to your new theme in your settings.
Edit: in addition, you can also load up wordpress on any page using:
include( '/path_to/wordpress_install/wp-load.php' );
This will allow you to use wordpress functionality on any page of your site.
just edited the single.php file by pasting the desired html code and leaving the loop code there where the text needed to show up.
didn't need to break up the page in a header, body and footer. Left out sidebar for now, but will put it back after I edit it properly.

Categories