Make another content list as content file of wordpress - wordpress

I have page I want to display the page in different style (not as the content.php file ) so now I made copy the content.php file and just modified it. I want to display only for one page and other pages should display like content.php . So how can I change the index page to display the particular as new content-list page. My page name is News and it should be display like content-list.php.

For display indiviual page you have to make a Template for that page and from
Dashboard-->Pages open the page where you want to display that template, on right hand side you have seen TAMPLATE-->DEFAULT TEMPLATE, select template you have created...
Syntax for new template
<?php
/*Template Name:abc
*/
?>
<?php get_header();?>
<!--------------------------------------->
CONTENT FOR PAGE
<!--------------------------------------->
<?php get_Footer();?>

I don't know about which file you're referring to as content.php
I have page i want display the page in different style
So, if you want to display a page with a different style, you should have a look at WordPress Template Hierarchy.
You can create another page template, use custom files like header-{name}.php and footer-{name}.php and use get_header() and get_footer() with the appropriate arguments(the {name} you mentionned to call these files.

Related

how to move the physical location of the permalink header in wordpress?

Does anyone know how to move the physical location of a permalink header in wordpress? I dont want it to be the first thing that is seen but rather I want a shortcode item there.
In your page.php you can delete the php function for calling the header ( the_header() ) and put the function to call the shortcode ( do_shortcode() ).
This way the page is not embeding the header.php but get the code of your shortcode at this place of your markup.
Page Template:
You can create a page template in your theme-folder. For this, you can simple duplicate the page.php and call it page-yourname.php. At the top of your page you add the name of the page template:
<?php /* Template Name: Example Template */ ?>
In that file you do the adjustments that you like to do with the shortcode.
https://developer.wordpress.org/themes/template-files-section/page-template-files/
With the template structure of wordpress, the template will automatically be found at the edit screen of your pages. It will be found on the right side under "page attributes".
You can set the template for your individual pages. So your adjustments to the template will only affect your pages, where you selected the template in the page attributes.

Wordpress: How can I create a page template out of an existing page?

I need to apply the same content on over 4000 Wordpress pages. Now to make it as easy as possible. I create a single page and designed it with the content. So what I want to do now is create a template out of this page. Is there any possibility to export the page as php code to put it in the theme as a template?
(It hast to be the exact content as the template file)
I am also open-minded for other Ideas to solve this problem. Thanks a lot!
Yes, you can create a template and apply your template to your pages.
With the content that you wish to apply to your pages, create a .php file. At the top of this.php (called say page-mycontent.php) file add this header:
<?php
/* Template Name: My Template */
?>
Now the template will appear in the admin panel for Page - Edit on the right hand side.
Code Changes in header.php and page.php
Your changes are in both the header and the loop. So I suggest creating two templates, one for the header and one for the body.
In your header.php, if you name your header code as header-myheader.php then pull your new header template into header.php like so:
<?php get_header('myheader'); ?>
And similarly add your body code (called mytemplate.php say) into page.php like so:
<?php get_template_part('mytemplate'); ?>

Convert one page website to multiple wordpress pages

I have a working one page website I like to convert into multiple pages in wordpress.
I already successfully created a theme, converted the header, footer, css, js into wordpress, header.php, footer.php, and functions.php by following a tutorial.
Now I'm left with all my html content between the header and footer and want to cut that content up into multiple wordpress pages.
I can do "the_title(); wrapped in php" and make the content while loop to get the first page into a wordpress page, but from then I dont know what to do, to split the next lines of html into other wordpress pages.
You will need create some page templates for your theme. They will look something like this:
page-about.php
<?php
/* Template Name: About Page */
get_header(); ?>
... about page content
<?php get_footer(); ?>
page-contact.php
<?php
/* Template Name: Contact Page */
get_header(); ?>
... contact page content
<?php get_footer(); ?>
Then assign the template in the Wordpress admin, on Edit Page view to the corresponding templates you want to use. You select the template by the name you give it in the comments.
The actual file name of your templates matter. Some views in wordpress are assigned to templates simply by the name of the file. So you will want to use certain naming conventions like page-about.php. More info about templates: https://developer.wordpress.org/themes/basics/template-hierarchy/

Two pages with same content

How to create two pages with same content?
For example, the first page should be with a header menu and the second page should be without a header menu.
The page of my theme has an options without header
Or I can use two different templates of page, but the content of pages should be the same.
You can read the documentation here.
Create a file, called page-mytemplate.php under your theme directory.
In that file, start with this:
<?php
/*
Template Name: My Custom Page
*/
Create a page, and set the template to My Custom Page.
At here you can do whatever you want.
For the other page, repeat the steps, but just call the other template something different name.
EDIT
When you want to show the same content with different templates, just simple get the content of the page:
$post = get_post($postId);
echo $post->post_title ."<br />";
echo $post->post_content;
You can wrap this with your two template page. See the documentation here

Wordpress pages theme/layout

I'd like to know whether I could have different layout and content for each page?
For example, I have 4 pages, and I have 4 completely different layout design, do I need to make 4 themes then apply to different pages or something else?
Moreover, can I have different posts show on different page?
like post no.1/or tag [google] goes to page 1, post no.5/tag[orange] goes to page 3?
I'd like to learn how to structure this idea.
Many thanks
make the diffrent template for different pages to show the different design on every page
for making template create normal php file and at the top of file add the code for every template by replacing template name
<?php
/*
Template Name:About Us
*/
?>
By this you get different template for about us put you code desing that you want to show for this page and from that back end select the template from rignt hand side option and save that page .
And to show different post on different pages you need to create category after that where you want to call the post for page call the category code for that
<?php Query_post('cat=3&showposts');
while(have_posts()): the_post();
the_title();
endwhile; wp_reset_query(); ?> every time on different page you just chage the category id (cat)

Resources