How can I make a header taller in WordPress? - php

I want to make the header of this WordPress page taller. I found advice here that I should use the following code in the homepage template CSS file:
.full-container {
min-height: 390px;
}
The CSS file looks like this:
<?php
/**
* The template for displaying the home page panel. Requires SiteOrigin page builder plugin.
*
* Template Name: Page Builder Home
*
* #package vantage
* #since vantage 1.0
* #see http://siteorigin.com/page-builder/
* #license GPL 2.0
*/
get_header();
?>
<div id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<div class="entry-content">
<?php
if ( is_page() ) {
the_post();
the_content();
}
else if( function_exists('siteorigin_panels_render') ) echo siteorigin_panels_render('home');
else echo siteorigin_panels_lite_home_render();
?>
</div>
</div><!-- #content .site-content -->
</div><!-- #primary .content-area -->
Where must I put the suggested code in?

In a Child Theme or wp-content/themes/vantage/style.css

The code you showed there as the CSS style is not the style at all, thats a costum page template named "Page Builder Home".
You should open style.css which is found directly on the theme folder. At the very end of style.css add the lines of css:
.full-container {
min-height: 390px;
}
If you dont know how to difference css files from php/html files then you definitely are in the wrong business and you should let the work be done by the pro-s.
having said that, hope my "solution" works for you.

Related

WordPress Twenty Seventeen static home page doesn't execute my custom template

I've built a custom page template in my twentyseventeen child theme that I know is working fine when I go directly to that page but when I set home page of my site to be a static and pointing to that page nothing displays. It will display any of text I have in the body but it does not seem to run any of the code in the template.
The static home page is here: https://wanderreader.com/
The page running on its own is here: https://wanderreader.com/book-list/#
I based my template on the TwentySeventeen page.php and, like I said, I know the code is working fine when I run the page on its own (i.e. not as a static home page) so I'm really scratching my head as to why it doesn't run any of my code when I set it to the home page.
<?php
/**
* Template Name: TravelBooksHome
*
* Derived from the 'page' template for displaying all pages
*
* This is the template that displays all pages by default.
* Please note that this is the WordPress construct of pages
* and that other 'pages' on your WordPress site may use a
* different template.
*
* #link https://codex.wordpress.org/Template_Hierarchy
*
* #package WordPress
* #subpackage Twenty_Seventeen
* #since 1.0
* #version 1.0
*/
get_header();
//Set the Nonce to avoid any shenanigans with the ajax calls
$ajax_nonce = wp_create_nonce( "<removed for posting>" );
?>
<div class="wrap">
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<div id="MessageArea">
</div>
<div id="SelectedCategory">
Home
<br>
</div>
<hr>
<div id="FilterCategories">
<?php
$categories = get_categories( array(
'orderby' => 'name',
'show_count' => true,
'echo' => false,
'title_li' => '',
'depth' => '1',
'use_desc_for_title' => false,
'parent' => 0
) );
foreach ( $categories as $category ) {
printf( '%2$s<br />',
"categorySubmit('".$ajax_nonce."', ". $category->term_id .")",
esc_html( $category->name )
);
}
?>
</div>
<hr>
<div id="BookList">
</div>
<div id="BookCovers">
</div>
</main>
<!-- #main -->
</div>
<!-- #primary -->
</div>
<!-- .wrap -->
<?php get_footer();
You may want to take a look at this document: https://codex.wordpress.org/Creating_a_Static_Front_Page
On the site front page, WordPress will always use the front-page.php
template file, if it exists. If front-page.php does not exist,
WordPress will determine which template file to use, depending on the
user configuration of 'Settings > Reading ->Front page displays', as
follows:
A static page: WordPress uses the Static Page template hierarchy:
Custom Page Template, page-{id}.php, page-{slug}.php, page.php,
index.php
Your latest posts: WordPress uses the Blog Posts Index
template hierarchy: home.php, index.php
I think in your case you just need to edit or create front-page.php instead of page.php.

Template page not showing data in WordPress

I created a template page on WordPress Admin and just added a h2 heading which does not appear with associated link for the page but it's working if admin logged in wordpress login. I also made the page public on page setting but still the problem is not remove page data shown only to admin. I have searched many forums but didn't find any solution.
<?php
/*
Template Name: Contact Us
*/
get_header(); ?>
<div class="contact-box1">
<h2 >
<br><br>
YOUR ENQUIRY
</h2>
<?php get_footer(); ?>
its working fine in here its not problem with the templating i guess you have not selected the template name right side of the dashboard and only put one contact us to the page as http://amplifiedantennas.com.au/contact-us doesnt have anything assigned over there
how to create template in WordPress?
<?php
/**
Template Name: Contact Us
*
* This is the template that displays all pages by default.
* Please note that this is the WordPress construct of pages
* and that other 'pages' on your WordPress site may use a
* different template.
*
* #link https://codex.wordpress.org/Template_Hierarchy
*
* #package WordPress
* #subpackage Amplified_Antennas
* #since 1.0
* #version 1.0
*/
get_header();
?>
<?php
while ( have_posts() ) : the_post();
?>
<div class="contact-box1">
<h2>Contact ENQUIRY</h2>
</div>
<?php
endwhile; // End of the loop.
?>
<?php
get_footer(); ?>
EDITED (I included the full code now):
It's not enough to include the header and the footer, you also need to include the loop in order to fetch the content which was for that particular page in the text editor (in the backend), where you should add/create your content.
So after creating that template, you need to create a "new page" in the backend, selecting that page template in the right sidebar.
In my example below, you would write your header into the title field in the backend, then it would be displayed as an h2 in the real page. And the whole content (inluding that title h2) is wrapped in the .contact-box1 DIV, as you had it in your original code.
example:
<?php
/*
* Template Name: Contact Us
* #package WordPress
* #subpackage Amplified_Antennas
*/
get_header(); ?>
<div class="contact-box1">
<?php
if ( have_posts() ) {
while ( have_posts() ) {
the_post();
<h2><?php the_title(); ?></h2>
<?php the_content(); ?>
} // end while
} // end if
?>
</div>
<?php get_footer(); ?>
P.S.: In your posted code, you are not closing this DIV tag: <div class="contact-box1">

WordPress Sidebar goes beneath the post [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
This
is my website I don't know for what reason my sidebar is not showing on the aside and it has gone down. Please anyone help me to fix this issue.
index.php
<?php
/**
* The main template file.
*
* This is the most generic template file in a WordPress theme
* and one of the two required files for a theme (the other being style.css).
* It is used to display a page when nothing more specific matches a query.
* E.g., it puts together the home page when no home.php file exists.
*
* #link https://codex.wordpress.org/Template_Hierarchy
*
* #package Trevelle
*/
get_header(); ?>
<div class="background">
<div class="container padding-top">
<div class="row" id="primary">
<main id="content" class="col-sm-8">
<?php if ( have_posts() ) : ?>
<?php /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php
/*
* Include the Post-Format-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
*/
get_template_part( 'template-parts/content', get_post_format() );
?>
<?php endwhile; ?>
<?php the_posts_navigation(); ?>
<?php else : ?>
<?php get_template_part( 'template-parts/content', 'none' ); ?>
<?php endif; ?>
</main>
<aside class="col-sm-4 lead text">
<?php get_sidebar(); ?>
</aside>
</div>
</div>
</div>
<?php get_footer(); ?>
and here is CSS because its lengthy http://jsfiddle.net/go75571m/
EDITED, ALL NEW ANSWER:
Your theme's CSS contains one setting that breaks the underlying bootstrap CSS.
Locate the following file and open it:
"/trevelle/wp-content/themes/trevelle/style.css"
On lines #2492 - 2497 of that file you find the following rule:
main {
padding:25px;
margin:10px 5px;
color:black;
line-height:30px;
}
In there, change
margin to 10px 0;
That should do the trick. I don't know if that's a little error in the theme or if the wrong behaviour is also caused by something else, but right now, this will fix it.
Those 5px margin left and right of the main element were just a little bit too much: 66, 6667% width (main) plus 33,3333% width (aside) = 100% PLUS those 10px just won't fit into the surrounding container...

How to make a right sidebar for a wordpress theme

How I can make a right sidebar for a wordpress theme and integrate with advanced search like the concept below:
sidebar.php
<?php
/**
* The sidebar containing the main widget area.
*
* #link https://developer.wordpress.org/themes/basics/template-files/#template-partials
*
* #package custom
*/
if ( ! is_active_sidebar( 'sidebar-1' ) ) {
return;
}
?>
<div id="secondary" class="widget-area" role="complementary">
<?php dynamic_sidebar( 'sidebar-1' ); ?>
</div><!-- #secondary -->
<?php if ( is_active_sidebar( 'sidebar-2' ) ) : ?>
<div id="tertiary" class="widget-area" role="supplementary">
<?php dynamic_sidebar( 'sidebar-2' ); ?>
</div><!-- #secondary .widget-area -->
<?php endif; ?>
style.css for sidebar
#secondary { /* left Sidebar */
width: 18rem;
margin-left: -67rem;
float: left;
position: relative;
}
#tertiary { /* right Sidebar */
width: 18rem;
margin-right: -23rem;
float: right;
position: relative;
}
How I can achieve it in an easy way?
Have a look at the WordPress Codex for information about customizing the sidebar. This page has a lot of information on it about the sidebar: https://codex.wordpress.org/Customizing_Your_Sidebar
If you are asking how to get a menu to expand from the side of the screen, there are many different CSS/JavaScript implementations, but perhaps something like this jQuery Slick Plugin might help: http://www.designchemical.com/lab/jquery-slick-plugin/examples/
If you are asking how to create the custom search functionality, then that is going to be very dependant on the plugins you are using and what you are searching for. This article does give a good overview of getting started with customised search capabilities and custom search forms in WordPress: https://premium.wpmudev.org/blog/build-your-own-custom-wordpress-search/
If you already have your sidebar.php set up in your template file where you want it; it could be index.php,single.php,page.php or whatever
I see two ways of doing it
1 - Install some fancy search plugin and add it your sidebar using Dashboard - Appearance - Widgets area
2 - In your Widget area you can add Html content where you will have your search form OR hardcode it in your sidebar.php OR create search-form.php(where you will have your form) and include it in your sibedar.php or directly to the template file using get_template_part()
here are some useful links:
https://codex.wordpress.org/Function_Reference/get_search_form
https://codex.wordpress.org/Function_Reference/get_template_part

Wordpress: trying to make a single static blank page that shows the header/sidebar/footer of my twenty fourteen template

I have made a static blank page that also shows my website's header/sidebar/footer in it. Now what i am trying to do is get rid of the 'style' that my wordpress template css is forcing me to have on the page i am trying to create.
Here is my code:
<?php
/*
* Template Name: My own page!
* Description: I made a page!
*/
require (dirname(dirname( __FILE__ )).'/wp-load.php');
get_header(); ?>
<div id="main-content" class="main-content">
<?php
if ( is_front_page() && twentyfourteen_has_featured_posts() ) {
// Include the featured content template.
get_template_part( 'featured-content' );
}
?>
<div id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<!-- MY CONTENT!!! -->
Hello2.
<h1> hello.</h1>
<p>hello</p>
<input type="submit" name="connect" value="CONNECT" style="height:52px ; width:136px"/>
<p>hi</p>
<!-- -->
</div><!-- #content -->
</div><!-- #primary -->
<?php get_sidebar( 'content' ); ?>
</div><!-- #main-content -->
<?php
get_sidebar();
get_footer();
Any help appreciated.
You will need to overwrite the styles which are already in the theme. For example, you can give an id to your submit button like <input type="submit" name="connect" value="CONNECT" id="submitbutton"> and then style it according to your needs using CSS, for example:
input#submitbutton {
height: 52px;
width: 136px;
background: blue;
color: white;
}
Same goes for the <h1> tags. Give an <id> to your <h1> tag like <h1 id="hello"> hello.</h1> and then style it according to your needs using CSS, for example:
h1#hello {
color: black;
font-weight: bold;
font-size: 20px;
}
Use of Developer Tools over here will help you quite a lot in order to see how an element would look with your desired styles before actually making any changes to its CSS.
you will need to use something like
get_header('custom-header');
And use a custom header file to only load the stuff you want. You may need to create a custom function to override the scripts included by the theme...

Categories