How to Manage Wordpress theme header margin - wordpress

I have a Indian Chat Room Website
I am creating a custom theme, and elements behave as they should but when I place the <?php wp_head() ?> tag I get a top margin, at the top of my theme header.
When I remove the <?php wp_head(); ?> the margin goes away. I have been at this for a while any help would be great.

Can you add the <?php wp_head(); ?> so I can take a look at your website.
Also try this in your CSS:
html{ margin-top:0px !important;}

Related

Add an image to header of Enfold theme

I've a WP site with the Enfold-child theme. For the header, I choose to place the company logo upper left and main menu under the company logo. I would like to add an image on the right of the company logo but I don't try to do this.
Last part of header.php is the following
<?php
if(!$blank) //blank templates dont display header nor footer
{
//fetch the template file that holds the main menu, located in includes/helper-menu-main.php
get_template_part( 'includes/helper', 'main-menu' );
} ?>
<div id='main' class='all_colors' data-scroll-offset='<?php echo avia_header_setting('header_scroll_offset'); ?>'>
<?php
if(isset($avia_config['temp_logo_container'])) echo $avia_config['temp_logo_container'];
do_action('ava_after_main_container');
?>
Have I to modify this file to add the image? Can you help me, please?
Thanks!
try this. It's a Knowledgebase article from Enfold detailing how to add a Widget area to the header for adding custom code, ie an image.
It's what we use to do exactly that.
: http://www.kriesi.at/documentation/enfold/adding-a-widget-area-to-the-header/
if you do not want to touch the header.php you may consider using a css ::after selector

Cannot get the_content() to change font color on custom WP theme

I've run into a small problem coding my own WP theme from scratch (with a static Home page and a separate Blog page). I can't change the font-color of my blog posts (that display after I click them). So I have a two-part question:
Why can't I get the_content to change color on my single.php page? Here's my code:
<?php
get_header();
the_post();
if ( has_post_thumbnail() ) {
the_post_thumbnail('large');
}
?>
<div class="white">
<div class="container">
<h2 class="black-text light" style="margin:0;">
<?php the_title();?>
</h2>
<h5 class="black-text" style="margin:0 0 7% 0;">
<?php the_author();?>
</h5>
<p class="black-text">
<?php the_content();?>
</p>
</div>
</div>
<?php
get_footer();
?>
What's happening is on my single.php page (which I'm using to design my individual blog posts), I've put 'the_title();' in an <h2>, 'the_author();' in an <h5>, and 'the_content();' in a <p>. I've also told each of those elements to show as black text. However, only the <h2> and <h5> change to black text. When I inspect it with Dev Tools, what's happening is WP is ignoring my hard-coded <p>, and creating new <p> of its own WITHOUT the black-font formatting.
My second question:
Am I even doing this right?? It displays fine on my local development, but am I doing this all in the correct way? Basically, I have a front-page.php that displays my Home Page. Then I have an index.php that shows the main blog page with small excerpts. Then, when a user clicks on a single blog post to open it, the individual post is shown with the single.php template. Is this right?
If a reference would help, you can see it here: www.uptowndownentertainment.com/blog
The code is missing from your post, you need to indent it with four spaces to make it show up. Looking at this page you seem to have added this before the content:
<p class="black-text" style="color:black !important;">
But the actual text is inside another paragraph element so it's not affected by that code. Wordpress automatically does this when writing posts. The easiest solution might be to add this to your style.css:
.container p {
color: black;
}
And then remove the style markup from the headers and paragraphs. It's always better to keep styles in the CSS instead of right in the code.

How to add background image for only home page in wordpress

I have been working on wordpress theme & i want to add background image for only home page so please, help me.
You can add to body tag php if home get class "yourClass" and give BG for that class in css
<body class="<?php if (is_home()){echo 'yourClass';} ?>">
Or give inline background
<body <?php if (is_home()){echo 'style="background-image:url(images/yourBG.jpg);"';} ?>>
But i prefer first option with class
Good luck! :)

Wordpress .entry-content class will not properly align with sidebar

I've encountered another silly problem while trying to enable sidebar on pages on Wordpress Twentyeleven theme.
I've given my .entry-content class:
.entry-content {float:left !important;width:648px !important;}
excuse me for those !importants, I just don't dare to edit the default style.css...
Now I've added
<?php get_sidebar(); ?>
By the end of page.php, just above the get_footer stuff... and sidebar apparently displays UNDER my .entry-content, on the right hand side....
I've trying giving the sidebar a float:right, but it still won't float.
Here is an example.
Inside <div id="main"> you have a <div id="primary">.
Set a width on the primary div and this is solved.
Like this: #primary {width:400px;}

Create Grid Layout on Wordpress

I'm wondering if anyone could answer this question for me, the solution at the bottom didn't work for my situation.
http://wordpress.org/support/topic/create-a-page-with-a-2-or-3-column-content-layout
I'm working on a blank canvas at the minute. Haven't got a design for the page yet as the rest of the page's appearance will depend on whether or not I can get this element working.
Any help would be MASSIVELY appreciated. Can't get my head around how to do this.
just put your posts into divs for now
<?php if (have_posts()) ?>
<?php while (have_posts()): the_post(); ?>
<div class="wppost">
<h2>
<?php the_excerpt(); ?>
<p>">Read more...
</div>
<?php endwhile; ?>
<?php endif; ?>
and then style .wppost (or whatever you name it)
like so .wppost{width:32%; float:left}
that's not perfect, but it'll get you started. check out jQuery Masonry for an easy, slick fx for that.

Resources