I am creating a wordpress website and I am using the conditional menu plugin
but that does not work.
I have the home.php template I added using the code
<?php if(!is_front_page() && is(home)) ?>
and I have used the
<?php the_content(); ?>
function in the index.php.
Moreover I have the following specific page templates:
about-us,photos,vidos,contact
I have added those with the following code:
<?php
if(is_page(about-us)){
get_template_part('template-parts/about');
}
?>
The problem is the menu is not showing in the specific pages.
Can someone help me to fix it?
P.S:I used other plugins as well (like the Elementor plugin).
Related
I'm making a WordPress theme by myself since I'm working for the first time in Wordpress I've watched some tutorials about it.
I have page.php header and footer and ofc an index. I insert the content from the pages with this:
<?php echo get_post_field('post_content', $post->ID); ?>
but I tried the get_post in a while loop with same result..
Everything is fine but when I want to use a plugin I can't add to my page... When I insert the shortcode of it it shows only the shortcode string... There are some plugins where I can click a "view" option and it would show a page with my plugin (for example a calendar) but that page is empty...
When I activate an original theme it works instantly... So I'm sure something is missing from my theme something which can load the plugins but I couldn't find solution for it.
Any ideas?
Did you add the <?php wp_head(); ?> function before the head area of the html document is closing? It imports important scripts and styles from wordpress itself (and probably also from the plugins).
See here:
https://developer.wordpress.org/reference/functions/wp_head/
Before closing the body area, the template should also include
<?php wp_footer();?>
See here:
https://developer.wordpress.org/reference/functions/wp_footer/
I have written a head navigation using the full-width code module in Divi. It is in my Divi library as a global module and works perfectly with most of my pages, but not the ones that are using my custom templates.
The way I am displaying the module is by using it's shortcode at the bottom of my child theme's header.php right before the closing header tag:
<?php echo do_shortcode('[showmodule id="XXXX"]'); ?>
where XXXX is the actual id. But on the pages using custom templates the module displays as plain text like so:
'[et_pb_section global_module="my modules id"][/et_pb_section]'
I have also tried changing the code to:
echo apply_filters('the_content','[showmodule id="XXXX"]');
however, the same issue occurs.
Any Ideas?
I found a good method for this in a thread in the Divi Support Forum, which this dude also explains in a video:
https://www.youtube.com/watch?v=PJqcfz5NyZs
Once you get the global Module number from the URL when viewing it in the Divi Library, the shortcode syntax to load the global module in php is:
<?php echo do_shortcode('[et_pb_section global_module="###"][/et_pb_section]'); ?>
One drawback is that loading a module through a php template file does not allow it to be editable through the Visual Builder.
So, I made a modification to this so I could have an easier place to edit the global footer by adding it to my site's homepage Divi layout, then adding this snippet in my footer.php template file to load on the rest of the pages:
<?php if ( !is_front_page() ) : ?>
<?php echo do_shortcode('[et_pb_section global_module="2310"][/et_pb_section]'); ?>
<?php endif; ?>
This way I can easily have a client use the Visual Builder on the homepage to edit the global footer, instead of having to find it in the Divi Library, which they would likely forget and takes extra click to get there.
Please try adding this code. It will solve your problem
<?php echo do_shortcode('[showmodule id="my modules id"]'); ?>
I'm currently doing some refactoring on an existing wordpress website that uses 9 page templates and I have the following problem:
All these pages have the same code written to display the header, the sidebar etc.
I wonder if it's possible for me to have a "parent" page that would be in charge of displaying those recurring template parts?
The reason I can't manage to do it is that only the page template file is called and no parent file.
That's what I would like to achieve:
<?php
// page-master.php
get_header();
get_sidebar();
get_page_content(); // includes the actual page template.
get_footer();
?>
I hope you understand what I'm looking for :)
Thanks in advance!
Create template your-name.php
Put that code
<?php
/*
Template Name: Your Name
/*
get_header();
get_sidebar();
get_template_part(template-hepler/your-name-content.php); // includes the actual page template.
get_footer();
?>
Create your-name-content.php in template-helper folder
And write there your page content
Assing that template to nessasary pages
I'm using WordPress to build a simple personal website. I know (basic) HTML and CSS but no PHP, so I'm having a little trouble with a particular customization.
My theme inserts the title of the page at the top of the page. I would like to stop it from doing this on one page only (the home page).
Thanks for any help. The site is here: http://www.melvingauci.com/
Try going into your page.php template and remove <?php the_title(); ?>. Then add this:
<?php if ( ! is_front_page() ) { ?>
<?php the_title(); ?>
<?php } ?>
Note: This assumes your home page uses the page.php template. If another template is used, then the same approach will work.
I'm trying to incorporate some custom made php files in a WordPress site.
In these files made links to other files.
<?
echo "" $row['Name'] . "<br> ";
?>
This works fine with an php-execute plugin for WordPress. The only thing is that the show.php opens without the WordPress theme and layout.
How can I make a link so that a new php file will open in the same (side)bar/frame with the same layout as the WordPress page?
you need to create a custom template for that
The syntax is something like this:
<?php
/*
Template Name: My Custom Page
*/
get_header();
?>
Here your HTML coding goes
<?php get_footer(); ?>
This will give you the look and feel you are looking for!!
Found my own work around
Create a page in WordPress (page_id=x) and include an exec-php plugin.
Include this code on the page.
<?
$page_include =$_GET["page_include"];
include $page_include;
?>
If you want to show a custom page in the wordpress them make the following link:
<?
echo " link "
?>