wordpress custom text in header.php as page of edit field - php

I been creating a template from scratch in wordpress and now I have a template header with a image in it a text/ subheader text. And below that all some info text. What I want is that I can change that info text like a page or custom field in the backhand of wordpress.
This text as example I want to edit in the backhand : CUSTOM HEADER TEXT
see the code below:
<!doctype html>
<!--[if IE 8]> <html class="no-js lt-ie9" lang="nl" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="nl" > <!--<![endif]-->
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title><?php echo wp_title(' | ', false, 'right') . get_bloginfo(); ?></title>
<?php wp_head(); ?>
</head>
<body>
<header>
<div class="row">
<div class="large-12 columns">
<div class="large-12 columns">
<h1><?php bloginfo('name'); ?> <span class="description">| <?php bloginfo('description'); ?></span></h1>
</div>
<p>CUSTOM HEADER TEXT</p>
</div>
</div>
</div>
</header>

Just go to admin => Appearance => Widgets, Drag a text widget in any of your sidebar and put the text "CUSTOM HEADER TEXT" in the text widget and save it.
After that just go to your header file where you want to show this text and put this code snippet : <?php dynamic_sidebar( 'sidebar-1' ); ?> //here 1 is the id of your sidebar
Just check in front end, you will find the text but layout is a little different. To do this pixel perfect, go to your function.php file and search for your sidebar like "sidebar-1" and remove the extra divs from there.
Follow the above steps, you'll get what you want.

Related

How do I change – (endash) to | (vertical bar) in my browser?

In the browser tab info of my site I want to replace the dash with a vertical line.
So instead of Site Name - Site Tagline it would be Site Name | Site Tagline. It would also be like that on category pages, for example right now it is Site Name - Site Category but I would like Site Name | Site Category. I am using the Goodlife theme but I have added the header.php below. Does anyone know how I could change this?
header.php
<!doctype html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=1">
<link rel="profile" href="http://gmpg.org/xfn/11">
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
<?php wp_site_icon(); ?>
<?php
$header_style = ot_get_option('header_style', 'style1');
$general_boxed = (ot_get_option('general_boxed') == 'on' ? 'boxed' : '');
?>
<?php
/* Always have wp_head() just before the closing </head>
* tag of your theme, or you will break many plugins, which
* generally use this hook to add elements to <head> such
* as styles, scripts, and meta tags.
*/
wp_head();
?>
</head>
<body <?php body_class(); ?>>
<div id="wrapper" class="open">
<!-- Start Mobile Menu -->
<?php do_action( 'thb_mobile_menu' ); ?>
<!-- End Mobile Menu -->
<!-- Start Content Container -->
<section id="content-container">
<!-- Start Content Click Capture -->
<div class="click-capture"></div>
<!-- End Content Click Capture -->
<?php
get_template_part( 'inc/header/fixed' );
get_template_part( 'inc/header/subheader' );
get_template_part( 'inc/header/'.$header_style );
get_template_part( 'inc/header/pageskin' );
?>
<div role="main" class="<?php echo esc_attr($general_boxed); ?>">
According to this article, you need to add the following code inside functions.php:
function wploop_change_separator()
{
return '|';
}
add_filter('document_title_separator', 'wploop_change_separator');

How to make WordPress menu items?

I am learning WordPress and basically I have this very simple site, I have the following header file:
<!doctype html>
<html <?php language_attributes(); ?> >
<head>
<meta charset="<?php bloginfo('charset'); ?>">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title><?php bloginfo('name'); ?></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
<link rel="stylesheet" href="style.css">
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<header class="site-header">
<h1><?php bloginfo('name'); ?></h1>
<h5><?php bloginfo('description'); ?></h5>
<nav class="site-nav">
<?php
$args = array(
'theme_location' => 'primary'
);
?>
<?php wp_nav_menu($args); ?>
</nav>
</header>
Now I believe, the menu is actually created by the below line of code:
<?php wp_nav_menu($args); ?>
Now when I check in the Front End, i.e. I load my site, I see that the only item in my menu is "sample-page", I was following from 1:38 onwards HERE and you'll see how this guy get a menu with "about us", "home", "contact" etc…
Now why am I not getting the same and how can I create those menus?
To create your own menu, you need to first go to your wp-admin dashboard. Then go to Appearance/menus.
Here you can create your own menus, or modify existing menus. After you do this, choose the role of the menu from the near footer of the page, just before the "Save menu" option.
And I hope you're all done!
Your code is attaching the 'primary' theme location to wp_nav_menu. Go to your dashboard Appearance>Menu page and see if you have a Primary menu in
the dropdown next to 'Select a menu to edit'. If so, select it. The pages in that menu should show. You can add to them as needed.

Head content appears in the body tag (Wordpress)

My head content(metas, scripts etc.) appears in the body tag. I have header php with this code
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo('charset'); ?>">
<meta name="viewport" content="width=device=width">
<title<?php bloginfo('name'); ?></title>
<?php wp_head(); ?>
</head>
<header class="header">
<h1 id="logo">|||</h1>
<h4 id='title' ><?php the_title(); ?></h4>
</header>
<body>
and footer.php is closing it with this. `
<?php wp_footer(); ?>
</body>
</html>`
Already tried changing encoding from UTF-8 to UTF-8 without BOM using Notepad++, and still the same ,, this is my website if you wanna see with inspect [website]
website . Any ideas ? :S
Your html is broken:
<title> Name Lastname / Official Website</title>
^---- missing >

Convert a HTML Template into a WordPress Theme issue

I have been working on converting html simple template to WordPress theme so I create folder into xampp - htdocs - wp-content - themes and I create inside this folder 8 files
footer.php , functions.php , header.php , index.php , page.php
sidebar.php , single.php , style.css
In footer file i add this code:-
</div>
<?php get_sidebar();?>
<div style="clear: both;"> </div>
</div>
</div>
</div>
<!-- end #page -->
</div>
<div id="footer">
<p>Copyright (c) 2013 Sitename.com. All rights reserved. | Photos by Fotogrph | Design by FreeCSSTemplates.org.</p>
</div>
<!-- end #footer -->
</body>
</html>
and in header file i add this code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title><?php bloginfo('title'); ?></title>
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:200,300,400,600' rel='stylesheet' type='text/css'>
<link href="<?php bloginfo('stylesheet_url'); ?>" rel="stylesheet" type="text/css" media="screen" />
<?php wp_head(); ?>
</head>
<body>
<div id="wrapper">
<div id="header-wrapper">
<div id="header">
<div id="logo">
<h1><?php bloginfo('name'); ?></h1>
<p><?php bloginfo('description'); ?></p>
</div>
</div>
</div>
<!-- end #header -->
<div id="menu">
<?php wp_nav_menu(); ?>
</div>
<!-- end #menu -->
<div id="page">
<div id="page-bgtop">
<div id="page-bgbtm">
<div id="content">
and in index file this code
<?php get_header(); ?>
test
<?php get_footer(); ?>
I go to my admin page and find this as a theme there and I active it.
But I find it very empty and I didnt know what wrong.
If you get only blank screen then in most cases there is some misconfiguration in functions.php, do you have any code in there?
I'm not sure if it will solve your problem, but try using wp_enqueue_style() function in your functions instead of echoing your styles in header.
function theme_slug_enqueue( ){
wp_enqueue_style( 'open-sans', http://fonts.googleapis.com/css?family=Source+Sans+Pro:200,300,400,600' );
wp_enqueue_style( 'main-style', get_stylesheet_directory_uri() . 'style.css' );
}
Put that in your functions.php, and delete elements from your header.
bloginfo('stylesheet_url') function only gets your main directory url, you are not calling your mains style.css anywhere as I can see. If you don't want to use wordpress standard enqueue function at least try changing
<link href="<?php bloginfo('stylesheet_url'); ?>" rel="stylesheet" type="text/css" media="screen" />
to:
<link href="<?php bloginfo('stylesheet_url') . 'style.css'; ?>" rel="stylesheet" type="text/css" media="screen" />
refference: https://codex.wordpress.org/Function_Reference/wp_enqueue_style
Wordpress theme required atleast two files to work so first check your theme by including only two files in your theme folder
wp-content/themes/mytheme/
style.css
index.php
add these lines in your style.css file
/*
Theme Name: My theme
Version: 1.0
*/
and add these line in your index.php file
this is theme testing
then run your wordpress website and check
Well you have to create a new folder inside the theme folder. SO it should look like this
wp-content
themes
Theme-name (lets say bruno)
header.php
footer.php
index.php
style.css
Now in style.css, its important that you add these comments.
/*
Theme Name: Bruno theme
Theme URI: Your site
Author: Your name
Author URI: http://yoursite.org/
Description: Some description
Version: 1.0
*/
These comments will tell wordpress all the information about your theme

In IE: my CSS has been changed while using a mysql based SESSION with php

This has been stumping me all day. I'm using a mysql based SESSION on my php file. All of the other browsers, except IE, are displaying my pages with the appropriate CSS files and they look fine (more specifically, it is changing my hover effects on my menu and changing the alignment of my footer). I've tested the file without the SESSION code in IE and it works fine. What is causing IE to change my layout when the SESSION is added?? Very frustrated. I'm sure you can tell I'm a php beginner from this message. Please help. Thank you.
James
<?php
session_start();
if(#$_SESSION['auth'] != yes)
{
header("location: http://www.setdesign-la.com/login_reg.php");
exit();
}
echo "<center><a href='logOut.php'>Log Out</a></center>\n";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
Bagelmania | bagels and spreads | delicious coffee | sandwiches
<link rel="shortcut icon" href="bm.ico">
<link rel="stylesheet" type="text/css" href="http://www.setdesign-la.com/bagelmaniaStyle.css"/>
<link rel="stylesheet" type="text/css" href="http://www.setdesign-la.com/bagelmaniaMainMenu.css"/>
<link rel="stylesheet" type="text/css" href="http://www.setdesign-la.com/bagelmaniaFooter.css"/>
</head>
<body>
<div id="topFade"></div>
<div id="banner">
<div id="bannerContainer">
<div id="bannerContent">
<div id="bannerFlower">
</div>
<!-- END BannerFlower -->
<div id="bannerPar">
</div> <!-- END bannerPar -->
</div><!-- END bannerContent -->
</div><!-- END bannerContainer -->
</div><!-- END banner -->
<div id="menuWrapper">
<div id="menuContainer">
<div id="centeredmenu">
-Home
-Affiliate Marketing
-SEO
-Training
-Articles
-Tacos
-Yum
</div> <!-- END centeredmenu -->
</div> <!-- END menuContainer -->
</div> <!-- END menuWrapper -->
<div id="wrapper">
<div id="container">
The reason is probably that you are outputting HTML before you are declaring the doctype. That causes IE to switch to quirks mode.
Solution: Move this line
echo "<center><a href='logOut.php'>Log Out</a></center>\n";
into the HTML document.

Categories