I created an own template for WordPress 3.4.1 and got the problem that WordPress automatically(???) generates titles for every single page I create, but I don't want the page-titles as headline.
My template bases on the "Modern Theme" for Magento eCommerce. After adapting for WordPress it consists of footer, header and index.php and a style.css without attributes for page-titles. - Kind regards.
Remove the <?php get_title() ?> from the page.php and single.php.
Since it is a display issue, you should add display:none; to the corresponding css class or id, no need to remove the_title or get_title.
Related
I want to display shortcodes (I'm using fruitful Shortcode) above the post title tag (H1). And I want to display it to all my post (also as a template).
i want to be like this
Thanks.
If you want to adjust the way your single posts are displayed for all the posts, you have to edit the single.php file in your theme folder. You can do this in the backend under "Design" -> "Theme Editor" or you can access the folder and files via FTP.
For your default posts in wordpress you just need to open the single.php file and look for the h1 with your title. It can look something like:
<h1><?php the_title(); ?></h1>
Above that (if you want to display it above), you can put your shortcode with the do_shortcode() function:
<?php echo do_shortcode('[name_of_shortcode]'); ?>
If you are not using normal posts of wordpress but custom post types or something else, please have a look at the wordpress template hierarchy to find out, which file to edit or how to name the new files for creating template files: https://developer.wordpress.org/themes/basics/template-hierarchy/
If you are using a theme that is not made by you, you should make sure you keep your theme updateable. So if you overwrite the single.php, with the next update of your theme, the file will not have your edits. You need a child theme, if you want to keep your parent theme up to date but also customize it in the page templates. Here is a nice tutorial for child themes: https://www.smashingmagazine.com/2016/01/create-customize-wordpress-child-theme/
I have created separate footers for each language using plugin "Elementor - Header, Footer & Blocks".
All footers are linked to be shown on own language as you can see on screenshot below.
The problem is that website on all languages have always the same footer, which was last created.
Language settings has all check-boxes selected in "Custom post types and Taxonomies" and "Synchronization".
I had the same issue. Polylang, Astra theme, Header and Footer blocks. It just did not show the correct language version.
Today I solved it by using the Theme builder of Elementor Pro (Version 3.0.10) and re-created the Footers there for each language:
Theme builder 2 language versions of footer
Hope this works for you as well.
For having a different footer in a second language that you can add whatever you want, you have to:
Duplicate the Theme footer file and rename it: footer-fr.php (example)
Go to the "templates" folder from your theme and duplicate the footer.php file and rename it: footer-fra.php (I'm gonna use a different name, so you know what file I'm talking about) You can make changes in the "-fra" file in the language you want.
In your new footer-fr.php you need to add the footer language, in this example footer-fra:
<?php
get_template_part( 'templates/footer-fra', 'wrapper' );
?>
Duplicate the Single page file and rename it: page-fr.php (don't forget to add the line: Template Name: Page france). Go to the last line where you can find the
<?php
get_footer();
and add the footer there:
<?php
get_footer('fr');
Go to every page you have in the second language and select from Template section: "Page france"
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'); ?>
I'm using WordPress and I've made a number of posts. What file do I need to edit, so the same HTML shows on the bottom of all the posts?
there are so many file wordpress theme structure if you want to edit:
(i think you Edit single.php)
page.php : use for simple page
index.php : use for post page
single.php : use for single post if you want to change ur post setting
similerly footer.php, header.php
The default name of the template file used to display pages in Wordpress is named page.php. It is located in your current theme.
I am relatively new to wordpress, I am creating a custom theme, and so far it is going ok.
I currently have index.php, header.php, footer.php and sidebar.php.
I have now hit a bit that has been puzzling me for a couple of days.
My home page has a slightly different layout to other pages, how do I theme for that change?
My website is essentially made up, of 'static' pages and 2 posts pages, what can I do so that the homepage looks different to the other pages?
Create a page template called home.php. WordPress will use it automatically for the start page.
Example:
<?php
/**
* Template Name: Home
*/
get_header();
// Do your regular page.php stuff
get_footer();
See also the codex page an Conditional Tags.
Go into your dashboard, settings>reading, check what the setting is for your home page display. You may need to change it from the default "list of latest posts" to a static page of your choosing.
You need a front-page.php
Please see the template hierarchy
You need to use the built-in functions from wordpress such as is_home() and is_front_page().
Conditional Tags
If you have a front-page.php that will take precedence over home.php or page.php. Whether or not home.php or page.php are defaulted to (assuming you have both) can be controlled in Settings → Reading. If you do not have a front-page.php, home.php, or page.php, then index.php would be defaulted to.
One difference between home.php and front-page.php is that home.php defaults to being a blog index page. Though both home and front-page may be used to display static or blog index pages.
More info may be found Wordpress' Template Heirarchy page.