wordpress adding php files and linking to them - wordpress

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.

Related

How to add custom php file in wordpress theme

I just create a custom theme for WordPress and this is my directory.
theme/
-index.php
-header.php
-footer.php
-terms.php
Now I want to make in index.php file have like
Terms
but this doesn't work.
How can I make this when the user clicks terms to redirect him on terms.php file?
actually you should create a Page in your admin menu for Terms and then link what what you want to that Page you created.
but before that I think you should learn more about wordpress and how it manage files and templates.

Wordpress page template option not displaying in dashboard?

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.

How to convert html website to wordpress theme?

i want to convert my html website to the wordpress. But can you please talk me that how i can convert and connect the other pages with the main page???
I'm going to start from the point of view you already have Wordpress and are ready to start.
You can't take your existing HTML website and just add it to WP.
What you need to do is to build your own custom theme, that matches your current HTML files, using the already existing WP templates and files.
Best way is to duplicate an existing theme to play/manipulate so that you don't break WP. The last thing you want to do, having no experience, is to mess with and break the default theme and be unable to get it back again without a full re-install.
RE 'connect the other pages with the main page' WP allows you to have static pages and set them as your home page and/or anywhere else you want. With these pages you can also set up different templates within your theme if you need to.
Wordpress have all this help available here:
Wordpress creating static pages and custom templates
Its not really that simple. You should read about WP theming. Here's the start:
https://codex.wordpress.org/Theme_Development
Check codes from other themes to see how to output basics. Theming has a lot of parts, but to ouput custom html you will need these files:
style.css
functions.php
index.php
single.php
With those you should have an basic blog output with core WP functionality.

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.

Resources