Wordpress page template option not displaying in dashboard? - wordpress

I'm using wordpress 4.9.6 version it's not showing page template option. I reinstalled wordpress and using default themes and plugins. I don't know the exact reason for this. Please help me out of this. Tell me the reason why it occurs.

Your theme must have template file. The default WordPress themes does not have that by default.
You need to create a new .php file, name it whatever and add this following code in the top:
<?php
/**
* Template Name: your template name
*
*/

One of the easiest way to create a Template, is as follows:
Creating the Template file:
Open up your preferred Text Editor. I would recommend Notepad++ for its 'best of both worlds' feel. It offers a greater range of tools than 'Notepad' whilst not being too overwhelming.
Next, you will need to enter the following code:
<?php
// Template Name: Name of Template.
?>
Then head to File > Save as ... and enter your desired file name. Then within the 'Save as type' dropdown menu, select 'PHP Hypertext Preprocessor file'. This file type will be appended with a series of file extensions, within a set of brackets.
Go ahead and select 'Save'.
Of course, don't forget to enter your relevant Template coding and save as you go along.
Upload to website:
With your Template file completed, you will now be ready to upload this to your website. One of the easiest way to do this, is as follows:
Download FileZilla. If you are unsure of which version to download, stick with 'Download FileZilla Client'.
Once downloaded and installed, open the program. Then login, with your site's credentials. If you are unsure of these, you will need to seek assistance from your hosting provider.
By now, you should see a screen like:
The above image has a lot of blank spaces. If you are logged in, these blank spaces will be populated with various folder and file names etc. Referring to the above image, take take of the contents within the red box. This text bar may be populated. Just enter '/httpdocs/wp-content/themes'. Alternatively, you can scroll through the Folders manually.
All you then need to do, is identify the relevant Theme and drag over the desired template file and drop it into the relevant theme's folder.
When it comes to WordPress themes, you may first want to familiarise yourself with Child Themes. Simply put, if you are not the Theme Author, you will need to create a Child Theme. If you modify the Parent theme, any file modifications will be lost. Whilst this wouldn't be the case, in this instance, you may wish to take this opportunity in understanding Child Themes and implementing said themes now, in preparation for future modifications.

The solution in my case was to add index.php file in theme's root folder.
It appears that adding my theme into Git repository (with Git Desktop) and selecting default .gitignore file of Wordpress incorrectly ignores the index.php file inside theme's root folder, so the file was never uploaded to the server after deploy and WordPress does not recognize the theme as valid one - hence the missing drop-down with template selection.

Related

How to remove a WordPress page from a path?

I have a site that was made in WordPress and I need to remake it just with HTML and php.
The problem is
I have a page at the url www.mydomain.com/create
I created a new file with same name, www.mydomain.com/create.php
Now on the host I removed the extension .php, but the problem is i will still hit the word press page.
Where can I find the file with the url set for this page? I don't know much about word press besides where plugins are.
WordPress does not use one file per page / post. WordPress instead has a template system inside themes that defines how pages and lists of posts are turned into HTML. The content of those pages and posts resides within the database and can be viewed in wp-admin. Further, WordPress extensions and themes can define hook functions and filters to modify content and style of the page and execute code upon certain events.
You cannot find a file for this "/create/" page. It has some content in the database but the content itself won't render into what you see in the browser.
Sorry to say this, but if you like to recreate the site, you will have to find a new way of constructing and rendering it (and also reusing code). You might also want to look for a proper framework like Laravel and have some proper routing in place (instead of renaming PHP files).
Edit:
You can change the permalink for create like so:
UPDATE PREFIX_posts SET post_name = 'create_old' WHERE post_name = 'create';
You have to adapt the MySQL table name to the WP posts table by replacing PREFIX with whatever prefix your WP posts table has.

Will I be able to update WordPress Paid theme if I change theme name from style.css file?

Suppose I've installed BE Theme in wordpress. If I change default theme name and other author info from style.css file, will I be able to get automatic updates later?
WordPress update system uses theme/plugin directory name/main file as slug for checking updates.
It means that you can change the values inside style.css and you'll still be able to check and perform updates (as long, as the name of directory stays unchanged).
On the other hand, there are two problems with such change:
These values will get restored after every update.
It's unethical. You're not the author of that theme and it's not your theme, so you shouldn't make your clients think otherwise. And if that theme is under GPL, then it's against its license.
But... You can (and you should) create a child theme and you can put whatever info you want in there.

i need to copy a Wordpress Web content to another with different templates

i need to copy some pages from a site to another. I got to use different templates in the different Wordpress installations... i tried, but some content or style is missing...
Example:
I need to copy this: http://iplido.org.ar/agenda
In this page: http://iplido.org.ar/web/agenda
What can i do? I tried to copy the php files, even some function.php code, but nothing works :(
To copy the style you need the same theme that is located in wordpress_dir/wp-content/themes/nameofyourtheme.
Copy it to the new installation and through your admin select it in appareance.

How can I extract the core of a Wordpress Theme and transfer / recode it to be used in Modx?

I have bought WP Themes to look at their code so that I can transfer them to Modx, are there specific folders I should look out for? If it helps one of the Wordpress Themes (Roots), uses the HTML5 Boiler Point and Twitter's Bootstrap.
Viewing Wordpress page source will do very little for you. You're going to get rendered php outputted for features and functions that have no relation to MODx.
Read MOSx's own docs on the process: MODX College: Porting WordPress Themes
http://modx.com/learn/modx-college/porting-wordpress-themes/
To do that follow the steps below:
Install your theme in wordpress.
View the wordpress with the new theme installed.
View the source of the page (Ctrl + u).
Copy the source.
Create new template in MODx.
Paste the copied source code to the new template you've just created.
Assign the template to a page (ie. home) and save.
View the page (click the 'View' button).
You will see, there will be all css, js, images and other files missing. Simply link all of these files in the newly created template. It's best to put them in the following directories on the server:
/assets/css/
/assets/js/
/assets/images/
After all files will be linked, select and cut the content from the template and paste it to the 'content' area of one of the resources (ie home) and click save.
In the template instead of the content you've just cut out, put
[[*content]].
That's basics. You can continue with other adjustments. MODx is very comfortable once you'll get a grip on it.

wordpress adding php files and linking to them

i'm wondering if it's possible to add a php file in your themes folder (wp-content/themes/classic) where the css file is, then link afterwards? Because i'm currently trying to add a register.php into my blog but i still need the header and everything else.
Yes. For example, if you want something like www.yourdomain.com/test follow this steps:
In your theme folder create a php file called page-test.php.
From your dashboard publish a page with the title Test(with no content at all).
Now, when you'll go to www.yourdomain.com/test you will se your page. And in page-test.php you can use all Wordpress functions such as get_header(), get_sidebar() etc.
Yes. What you want is to define a new "page" template, and then to create a new page in your wordpress using that template. Here's the WP documentation on that topic: http://codex.wordpress.org/Pages#Page_Templates
Alternatively, you don't have to place it in your theme folder; you can put it in the root wordpress folder and have it function outside of wordpress. Then you can change your theme to have a static link to that page, or link to it in some other manner. It would be more difficult to use the header/footer/sidebar template features, though.

Resources