css expand with content in wordpress template - assistance request - php

I have a PHP template but it seems to overlap the template (WordPress) when I add additional text. Any ideas? Code below:
<?php
/*
Template Name: Homepage Template
*/
?>
<?php get_header(); ?>
<div class="homecontent"></div>
<?php get_sidebar(); ?>
<div class="cleared"></div>
<?php get_footer(); ?>

Could you provide your CSS? I'm guessing that the problem is that you don't have a height on your div's.

Related

Wordpress - template hierarchy for custom page not working

I'm building a Wordpress site using html5blank as a parent theme for the first time. I have my main pages set up and working using page-slug.php naming convention and all works fine. A couple of these pages require sub-pages but for some reason I cannot get these to work. Example -
On of my main pages is titled 'Agency' and within the agency page I have a number of images which act as links to a number (7) of sub-pages -
I've set the first image up with the correct link and page parent/child as so -
page-agency.php
<div class="row">
<div class="twelve columns agencyproducts">
<p>WHAT PRODUCT ARE YOU INTERESTED IN?</p>
<a href="http://localhost:8888/agency/2k4k-production/"><figure>
<img src="http://localhost:8888/wp-content/uploads/2017/07/production.png" alt="Production">
<figcaption>2K / 4K PRODUCTION</figcaption>
</figure></a>
I've saved the sub-page file as page-agency-2k4kproduction.php in the theme file like the other pages. When I click on the link I get the page.php file showing with my header and form templates but not the sub-page code. Here's what I have in the page.php -
page.php
<?php get_header(); ?>
<?php get_template_part('form'); ?>
<?php the_content(); ?>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
In my 2k4kproduction.php file I have this -
page-agency-2k4kproduction.php
<?php get_header(); ?>
<!-- custom code -->
<?php get_template_part('form'); ?>
<?php the_content(); ?>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
Am I missing some steps in the hierarchy process?
I can't figure out why the main pages all work seamlessly but the sub-pages don't. I'v tried other permitations - page-2k4kproduction.php, 2k4kproduction.php, page-8.php and they don't work either.
Do I have to save sub-page files in a different file to the main page file?
Does the page order in in the admin make a difference? FWIW I've placed the sub page as next in line to the last main page (8) rather than start a new number order for sub pages.
Really stumped on this one, I'm sure its something quite obvious but I just can't spot it.
WordPress template hierarchy works perfect with page-$slug.php i don't know what could be the reason may be 2k4kproduction slug issue.
it's better to use page-template instead page-slug workaround because if the slug change it won't show your page. go through this tutorial for custom page template.
template-2k4kproduction.php
<?php /* Template Name: 2k4k Production */ ?>
<?php get_header(); ?>
<!-- custom code -->
<?php get_template_part('form'); ?>
<!-- custom code -->
<?php the_content(); ?>
<?php get_sidebar(); ?>
<?php get_footer(); ?>

Custom Page Templates Not Displaying In Dropdown

I'm working on a One-Page custom Wordpress theme him having some problem in the Backend of the WordPress. When every I make a Custom Page Template in my directory does not show up in dropdown I have added everything and save everything right insides the code.
This how him loading all the custom pages, header, and footer to load on front-page.
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php while (have_posts()) : the_post(); ?>
<?php get_template_part('templates/page', 'header'); ?>
<?php get_template_part('templates/modules/content', 'page-about'); ?>
<?php get_template_part('templates/modules/content', 'page-services'); ?>
<?php get_template_part('templates/modules/content', 'page-photography'); ?>
<?php get_template_part('templates/modules/content', 'page-portfolio'); ?>
<?php get_template_part('templates/modules/content', 'page-contact'); ?>
<?php get_template_part('templates/page', 'footer'); ?>
<?php endwhile; ?>
</main><!-- #main -->
</div><!-- #primary -->
Here are some screenshot of directory of custom pages that trying to load inside my dropdown template.
Page 1 https://gyazo.com/b5cb0349b68c9819cf4632b238201259
Page 2 https://gyazo.com/88baa34089370362c77edc2b67f12617
Page 3 https://gyazo.com/12f204187c92c7f2ec380845ee2490dc
Page 4 https://gyazo.com/2b05906194a6e4ee7c0eacf5d19b7bef
Page 5 https://gyazo.com/af8f59a00c68008eb833d8420a38961f
Backend https://gyazo.com/455f44b60d102856ea56cf2ad00adbb4
you are making one page theme and you created some templates but i can see in screenshot that you are calling all templates under home page so there is already header and footer included then why you are adding header and footer to all the other templates?
on one page theme you just don't need to include header and footer to every template

Creating a custom template page in wordpress causing other features to stop working

I'm new to wordpress and i'm trying to create a custom template. I'm using the default twentyfifteen theme. I went to wp-content/themes/twentyfifteen and copied page.php to a new file called page_with-contact.php and added this comment on the top :
/*
Template Name: Page with contact
*/
I made no other changes to the template.
I then went to the admin site and changed one of the pages to "page with contact".
When I open the page I see that the affix on the left menu is not working and the responsive menu is not working either.
I followed a pretty simple tutorial here so I'm just wondering what am I doing wrong.
EDIT
Following #masiorama's answer and the comments below is crated a child theme, moved the template file to the child theme and renamed it to page-with-contact.php, This is the content of the template
<?php
/*
Template Name: Page with contact
*/
get_header(); ?>
<div id="primary" class="content-area">
<main id="main" class="site-main my-content-page" role="main">
<?php
// Start the loop.
while ( have_posts() ) : the_post();
// Include the page content template.
get_template_part( 'content', 'page' );
// If comments are open or we have at least one comment, load up the comment template.
?>
<div class="hentry entry-content contact-form">
<?php
echo do_shortcode('[contact-form-7 id="19" title="contact form 1"]');
?>
</div>
<?php
// End the loop.
endwhile;
?>
</main><!-- .site-main -->
</div><!-- .content-area -->
<?php
get_sidebar();
get_footer();
?>
Now I have several problems :
As you can see the sidebar, heading and footer are all included but the affix and responsive menu are still not working.
The contact form (which previously worked fine) is now not showing at all.
I'm unable to enqueue the parent's rtl.css file.
Appreciate any further guidance.
As far as I know your page file should be named:
page-with-contact.php
and not:
page_with-contact.php
Be sure that it contains at least some wordpress function calls like:
<?php get_header(); ?>
<!-- stuff -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
Check this for more details: http://codex.wordpress.org/Page_Templates
Looks like you are calling a template within a template. 'get_template_part( 'content', 'page' );' should be the_content();. Good chance that's whats messing you around.
Need this WordPress hooke to call in your template
get_header();
get_sidebar();
get_footer();

Wordpress - whole sidebar as lin to a page

I included the latest post widget. Now I don't want direct to that certain single post but to a page instead. Shall I declare the whole sidebar as a link and wrap it in a tag. How is the code in PHP?
PHP
<?php get_sidebar(); ?>
HTML link
<?php get_sidebar(); ?>
First thing you need to know is the side bar is not a link. get_sidebar() is a function that displays your sidebar content.You should read the Codex about this function.
Remove get_sidebar() function from your single.php file and create a new page with a custom template. add get_sidebar() function to that template. Here is an example page template for you
<?php
/**
* Template Name: Custom Template
*/
get_header(); ?>
<div class="main">
<div class="left-content">
Your content goes here......
</div>
<div class="right-content">
<?php get_sidebar(); ?>
</div>
</div>
<?php get_footer(); ?>

Custom template not working with the following options

I followed this tutorial for the page specific template -- http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates
Created a page through wordpress admin panel - Blog Page URL like -- http://localhost/wordpress/blog-page/ and set template to my template "Swapnesh" from the admin panel itself.
Created my specific page template as page-blog-page.php containing following code --
<?php
/*
Template Name: Swapnesh
*/
get_header(); ?>
<div id="primary">
<div id="contentabc" style="border:7px solid red;">
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', 'page' ); ?>
<?php comments_template( '', true ); ?>
<?php endwhile; // end of the loop. ?>
</div><!-- #content -->
<?php get_sidebar(); ?>
</div><!-- #primary -->
<?php get_footer(); ?>
Now when im navigating to http://mysite/wordpress/blog-page/ im not getting that border so that i can proceed further, let me know what im doing wrong.
note-- Under "Reading Settings" mu post page selection was "Blog Page" when i dis select this option its showing me the red border but no posts then :(
I don't know if you've solved this yet but I think the problem relates to the belt and braces approach you've ended up with here. By naming your custom template page-blog-page.php it should negate the need to explicitly assign it as a custom template for a page with the slug blog-page.
Try changing the name of the custom template completely - my-template.php - to see what happens. I don't see anything obviously wrong with your code.
Have you selected Swapnesh as page template While creating new page ?
You can select it from right side Page Attributes.

Categories