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...
Related
This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 4 years ago.
I am trying to hide a sidebar widget in my wordpress theme. I've done what a help site suggests in the sidebar.php file. But when I add a new page I get a parsing error that says this on the right side of the page where the sidebar should be:
Parse error: syntax error, unexpected 'endif' (T_ENDIF), expecting end of file in C:\xampp\htdocs\Rustic1\wp-content\themes\restau\sidebar.php on line 18
<?php
/**
* The sidebar containing the main widget area.
*
* #link https://developer.wordpress.org/themes/basics/template-files/#template-partials
*
* #package Restau
*/
?><div id="sidebar">
<!-- Start widget comment>
<?php
if ( ! is_active_sidebar( 'sidebar-1' ) ) {
return;
}
?>
<aside id="sidebar" class="col-md-4 widget-area" role="complementary">
<?php dynamic_sidebar( 'sidebar-1' ); ?>
<?php endif; ?>
<End widget comment -->
</div>
</aside><!-- #sidebar -->
I want the sidebar removed from the entire theme.
You have HTML code between the comment and the next <?php tag. You need to exit PHP mode before the HTML.
<?php
/**
* The sidebar containing the main widget area.
*
* #link https://developer.wordpress.org/themes/basics/template- files/#template-partials
*
* #package Restau
*/
?>
<div id="sidebar">
<!-- Start widget comment
<?php
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">
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.
I'm trying to prepare a blog for microformat, so I need a div to start above the title and close just above the social share buttons (and below meta data, date, author, # of views, etc) - see site for reference: http://www.sara-maria.dk/sundt/laekre-saltede-mandler-med-soedt-tilbehoer/
It is a Wordpress site using CherryFramework with a childtheme and I've tried the following:
adding the opening of the div to title.php and the closing div to footer.php
However, for some reason the div is not using the expected closing div. Instead it is being closed way up higher on the page.
I've created a new functions.php in the childtheme and used the following code:
function my_content($content) {
global $post;
return ''.$content.'';
}
add_filter('the_content', 'my_content');
Problem is that this only wraps it around the post and my PHP skills are not very good, so I haven't been able to customize it to include the title and the meta data.
Anyone who can help me how I best can create the custom div?
Thanks,
Kasper
Update - copying in loop-single.php on request from dojs:
<?php /* Loop Name: Single */ ?>
<div id="loopTEST">
<?php if (have_posts()) : while (have_posts()) : the_post();
// The following determines what the post format is and shows the correct file accordingly
$format = get_post_format();
get_template_part( 'includes/post-formats/'.$format );
if($format == '')
get_template_part( 'includes/post-formats/standard' );
get_template_part( 'includes/post-formats/share-buttons' );
wp_link_pages('before=<div class="pagination">&after=</div>');
?>
</div>
<!---removed author block--->
<?php
get_template_part( 'includes/post-formats/related-posts' );
comments_template('', true);
endwhile; endif;
?>
Update
If you look at the DOM of your site you can clearly see that the title section is found in it's own file.
Take a look at this HTML
<div class="row">
<div class="span12" data-motopress-type="static" data-motopress-static-file="static/static-title.php">
<section class="title-section">
<h1 class="title-header">
Lækre saltede mandler med sødt tilbehør </h1>
<!-- BEGIN BREADCRUMBS-->
...
<!-- END BREADCRUMBS -->
</section><!-- .title-section -->
</div>
</div>
You would think that you have to add a div to "static/static-title.php", but that would most likely destroy the layout.
To be honest, the structure of this theme seems horrible to me (which means that the theme is shit), however if you are hell bent on using it you need to find the file (which would most likely be "single.php" in your themes root directory) that includes "static/static-title.php" and add a div on the line above that.
Okay, well to really see how this builds up your single post pages you might need to go through the included template parts, but try this to start out with.
<div id="loopTEST">
<?php if (have_posts()) : while (have_posts()) : the_post();
$format = get_post_format();
?>
<div> <!-- This should be above the title -->
<?php
get_template_part( 'includes/post-formats/'.$format );
if($format == '')
get_template_part( 'includes/post-formats/standard' );
?>
</div> <!-- This should be below the post but above the social media buttons -->
<?php
get_template_part( 'includes/post-formats/share-buttons' );
wp_link_pages('before=<div class="pagination">&after=</div>');
?>
</div>
I am pretty new in WordPress theme development and I have the following doubt about how show posts into a page.
I have this page belonging to an old custom legacy blog that I am build again using WordPress: http://www.asper-eritrea.com/comunicati.asp
As you can see in this page are presented some posts using the following structure: date followed by the post title followed by a short summary
What I want to do in WordPress is something like it.
So I have create this page that show the posts lists: http://lnx.asper-eritrea.com/category/legacyposts/
As you can see in this page are shown the posts (the formattation is horrible because I imported the post from the old website but I will work on it in a second time).
The main problem is that if the post is very long it is shows all of its contents.
This is the code of this page (category.php) is:
<?php get_header(); ?>
<!-- Contenuti (griglia) -->
<div class="container">
<!-- Lead presentazione -->
<section id="presentazione">
<div class="row">
<div class="col-sm-12">
<!--<h1 class="text-center"><small>Associazione per la Tutela dei Diritti Umani del Popolo Eritreo</small></h1>-->
<h1 class="text-center title">Associazione per la Tutela dei Diritti Umani del Popolo Eritreo</h1>
<h1 class="text-center leadTitle">Association in Defense of the Human Rights of the Eritrean People</h1>
<!--
<p class="lead text-center">
Association in Defense of the Human Rights of the Eritrean People
</p>
-->
</div><!-- /.col-sm-12 -->
</div><!-- /.row -->
</section><!-- /section presentazione -->
<!-- Progetti in evidenza -->
<header class="header-sezione">
<h2>Ultimi Articoli</h2>
</header>
<?
// get the term using the slug and the tag taxonomy
$term = get_term_by( 'slug', 'featured', 'post_tag' );
// pass the term_id to tag__not_in
query_posts( array( 'tag__not_in' => array ( $term->term_id )));
?>
<?php
if (have_posts()) :
// Start the Loop.
while (have_posts()) : the_post();
/*
* Include the post format-specific template for the content. If you want to
* use this in a child theme, then include a file called called content-___.php
* (where ___ is the post format) and that will be used instead.
*/
get_template_part('content', get_post_format());
endwhile;
else :
// If no content, include the "No posts found" template.
get_template_part('content', 'none');
endif;
?>
</section>
</div>
<?php get_footer(); ?>
So what I want to do is that, for each post, the loop show only the date, the title and the beginning of my post (for example a specific number of character).
What can I do to obtain this result?
Tnx
first you should start reading the wordpress codex, that way you can know how wordpress works.
Now, the category.php template is trying to find other template part with this code:
get_template_part("content", get_post_format());
This code is looking for content-post format.php, in case that file doesn't exist, wordpress automatically looks for content.php and that file is the one you have to work.
You must find this file and you use the following functions
the_excerpt();
get_the_date();
the_title()
Now if you want to control the size of the excerpt, you can use this function inside of function.php.
function custom_excerpt_length( $length ) {
return 20;
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );