WordPress 2014 Theme - Header Search Box - wordpress

I want to remove the green search box from the header but I don't know which file and lines in the Editor I must remove.
Regards.

You should not be editing default themes!
Create a child theme http://codex.wordpress.org/Child_Themes
The example actually shows using TwentyFourteen
Then copy the header.php to your child themes folder and edit it.
This way updates for TwentyFourteen will not over-write your changes.
When updates do come, compare the TwentyFourteen header.php with your header.php and make the updates to it.
OR better yet,
Create the child theme and add this to your style.css after the parent themes import
.search-toggle, #search-container {display: none;}
Then you do not need to modify or copy the header.php file at all.

You need to edit the header.php file of your WordPress theme that can be found at [your_WP_folder]/wp-content/themes/twentyfourteen/header.php.
Look for the <header> section and copy and paste the code below instead of the original.
<header id="masthead" class="site-header" role="banner">
<div class="header-main">
<h1 class="site-title"><?php bloginfo( 'name' ); ?></h1>
<!-- Hide Search button
<div class="search-toggle">
<?php _e( 'Search', 'twentyfourteen' ); ?>
</div>
-->
<nav id="primary-navigation" class="site-navigation primary-navigation" role="navigation">
<h1 class="menu-toggle"><?php _e( 'Primary Menu', 'twentyfourteen' ); ?></h1>
<a class="screen-reader-text skip-link" href="#content"><?php _e( 'Skip to content', 'twentyfourteen' ); ?></a>
<?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) ); ?>
</nav>
</div>
<!-- Hide Search Form (optional)
<div id="search-container" class="search-box-wrapper hide">
<div class="search-box">
<?php get_search_form(); ?>
</div>
</div>
-->
</header><!-- #masthead -->

Goto your_project/wp-content/themes/twentyfourteen/header.php file and open it.
Search for the word search-toggle and search-container (This one is optional).
.search-toggle
<div class="search-toggle">
<?php _e( 'Search', 'twentyfourteen' ); ?>
</div>
#search-container
<div id="search-container" class="search-box-wrapper hide">
<div class="search-box">
<?php get_search_form(); ?>
</div>
</div>
Remove both html block of codes or you can wrap them in a comment for later use like this:
<!--
<div class="search-toggle">
<?php _e( 'Search', 'twentyfourteen' ); ?>
</div>
<div id="search-container" class="search-box-wrapper hide">
<div class="search-box">
<?php get_search_form(); ?>
</div>
</div>
-->

Topdown is correct. Creating a child theme is very important.
But an easier way to remove search bar in twenty fourteen theme is to put .search-toggle { display: none; } in your child css file.
Here's a bit more information on customizing twenty fourteen theme in WordPress and how to create child theme for twenty fourteen theme.

Related

Creating a Wordpress Template From Scratch - Sidebar Placement

I'm creating a Wordpress template from scratch and I am already in the process of adding sidebars. But I'm having a few problems with the sidebar positioning/placements.
What I want vs What I have
I'm not sure if I'm doing something wrong with the sidebar.php or with the container blocks.
But here's my css code:
/* Sidebar modules for boxing content */
.sdbrcont {
float: left;
background-color: black;
}
My sidebar.php code:
<div class="sdbrcont">
<?php if ( is_active_sidebar( 'left_sdbr' ) ) : ?>
<div id="primary-sidebar" class="primary-sidebar widget-area" role="complementary">
<?php dynamic_sidebar( 'left_sdbr' ); ?>
</div><!-- #primary-sidebar -->
<?php endif; ?>
</div>
and if the problem is on my index.php, here's the code:
<div class="row">
<?php get_sidebar( 'left-sdbr' ); ?>
<div id="contentcont">
<div class="blog-main">
<div class="blogtitle">
<p>PAKU SQUAD
<span class="subheader1">
BLOG
</span>
</p>
<hr>
</div>
<?php
if ( have_posts() ) : while ( have_posts() ) : the_post();
get_template_part( 'content', get_post_format() );
endwhile;?>
<nav>
<ul class="pager">
<li> <?php next_posts_link( 'Older Posts >>>' ); ?> </li>
<li> <?php previous_posts_link( '<<< Newer Posts' ); ?></li>
</ul>
</nav>
<?php
endif;
?>
</div> <!-- /.blog-main -->
</div>
</div> <!-- /.row -->
This is my firt time creating a wordpress template and I would really appreciate all the help I can get. Thank you in advance.
You need to pay attention to Layout grid system in bootstrap: http://getbootstrap.com/docs/4.0/layout/overview/
Because you need to determine the width of the container, else will be all the body.
<div class="container">
<div class="row">
<div class="col">
Sidebar
<div>
<div class="col">
Content
<div>
</div>
</div>

Foundation 6 Wordpress theme

I am trying to add some animation to the mobile navigation to drop down slowly rather than have the page jumping. I am using the foundationpress theme. I can't seem to make it work with data-animate. This is my code snippet:
<div class="title-bar" data-responsive-toggle="site-navigation">
<button class="menu-icon" data-toggle="panel" type="button" data-toggle="mobile-menu"></button>
<div class="title-bar-title">
<div class="mini-logo">
<img class="mini-logo-img" src="/wp-content/uploads/2016/11/coc-logo.png" alt="Mountain View" style="width:4rem;height:auto;">
</div>
<!--<?php bloginfo( 'name' ); ?>-->
</div>
</div>
<!--<nav id="site-navigation" class="main-navigation nav-area" role="navigation" style="width:100%" >-->
<div class="top-bar-left">
<ul class="menu">
<li class="co-logo-top"></li>
<!--<li class="home"><?php bloginfo( 'name' ); ?></li>-->
</ul>
</div>
<div class="top-bar-right" >
<?php foundationpress_top_bar_r(); ?>
<?php if ( ! get_theme_mod( 'wpt_mobile_menu_layout' ) || get_theme_mod( 'wpt_mobile_menu_layout' ) === 'topbar' ) : ?>
<?php get_template_part( 'template-parts/mobile-top-bar' ); ?>
<?php endif; ?>
</div>
</nav>
I'm not seeing the actual '#mobile-menu' component in your code snippet, so not 100% sure what's happening here, but the thing to be aware of is that you need to have the data-animate attribute on the same element as you have your data-toggler attribute (which in this case is the thing being toggled, or '#mobile-menu'). See the example here: http://foundation.zurb.com/sites/docs/toggler.html#toggle-with-animation
have you tried triggering it with jquery/js? see this thread: https://github.com/olefredrik/FoundationPress/issues/772.
also check that you have added the data-toggler attribute to the element

Wordpress theme looks different in customize and live modes

I got tasked with fixing problems on my company's Wordpress instance. Since I'm novice when it comes to Wordpress and PHP I am sure that I am missing something trivial; problem I am having is that pages look different in preview and when viewed directly. For example, here is what part of HTML that gets rendered in live preview (for site header):
<header role="banner" class="clearfix" id="site-header">
<div class="container">
<!-- #logo -->
<div id="logo">
<h1>
My Site
</h1>
</div>
<!-- /#logo -->
<!-- #primary-nav -->
<nav class="clearfix" role="navigation" id="primary-nav">
</nav>
<!-- #primary-nav -->
</div>
</header>
However, when I visit site directly (go to http://example.com), I get following HTML in that part:
<div class="container">
<div id="logo">
<h1>
My Site
</h1>
</div>
</div>
I'm getting similar behavior when trying different themes. Thus, I'm suspecting something may be wrong with installation of Wordpress... however, I can't just re-install everything - I've inherited this Wordpress instance and must stick with it.
I have no problem with modifying php files and HTML - would just appreciate if someone more experienced with Wordpress would tell me where I should start looking. php files? CDN plugins?
EDIT:
Here is header.php from theme:
<!-- #header -->
<header id="site-header" class="clearfix" role="banner">
<div class="container">
<!-- #logo -->
<div id="logo">
<?php if (is_front_page()) { ?><h1><?php } ?>
<a title="<?php bloginfo( 'name' ); ?>" href="<?php echo home_url(); ?>">
<?php if (of_get_option('st_logo')) { ?>
<img alt="<?php bloginfo( 'name' ); ?>" src="<?php echo of_get_option('st_logo'); ?>">
<?php } else { ?>
<?php bloginfo( 'name' ); ?>
<?php } ?>
</a>
<?php if (is_front_page()) { ?></h1><?php } ?>
</div>
<!-- /#logo -->
<!-- #primary-nav -->
<nav id="primary-nav" role="navigation" class="clearfix">
<?php if ( has_nav_menu( 'primary-nav' ) ) { ?>
<?php wp_nav_menu( array('theme_location' => 'primary-nav', 'container' => false, 'menu_class' => 'nav sf-menu clearfix' )); ?>
<?php } ?>
</nav>
<!-- #primary-nav -->
</div>
</header>
<!-- /#header -->
I had this issue and I resolved it by changing the settings that were not displaying properly to something else (such as un-checking a checked box), publishing it, and then changing it back and publishing again. I'm guessing there was some mis-match somewhere between something cache and something database and this was a quick way to force them to match up again.
Just had a similar issue but rather I had the desired result in the customize preview but not in the actual site. I tried a variety of things in the themes code but sadly I think it just came down to a hard refresh of my customizer and page tabs (ctrl+F5 in chrome) then tweaking the slider and publishing.

Wordpress HTML coding standard for vertical spacing (space between HTML tags)?

I was reading Wordpress's coding standards
The only confusing part for me is the vertical spacing between HTML code for instance:
Default Wordpress Theme 3.03:
sidebar.php:
<li id="search" class="widget-container widget_search">
<?php get_search_form(); ?>
</li>
<li id="archives" class="widget-container">
<h3 class="widget-title"><?php _e( 'Archives', 'twentyten' ); ?></h3>
<ul>
<?php wp_get_archives( 'type=monthly' ); ?>
</ul>
</li>
(Here's space between the two <li> tags)
header.php
<div id="masthead">
<div id="branding" role="banner">
<?php $heading_tag = ( is_home() || is_front_page() ) ? 'h1' : 'div'; ?>
<<?php echo $heading_tag; ?> id="site-title">
(Here, there's no space between div tags)
header.php (line 79...):
</div><!-- #branding -->
<div id="access" role="navigation">
<?php /* Allow screen readers / text browsers to skip the navigation menu and get right to the good stuff */ ?>
<div class="skip-link screen-reader-text"><?php _e( 'Skip to content', 'twentyten' ); ?></div>
<?php /* Our navigation menu. If one isn't filled out, wp_nav_menu falls back to wp_page_menu. The menu assiged to the primary position is the one used. If none is assigned, the menu with the lowest ID is used. */ ?>
<?php wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary' ) ); ?>
</div><!-- #access -->
</div><!-- #masthead -->
</div><!-- #header -->
<div id="main">
(Here, there's is space between those 3 <div> tags
What's the coding standard of vertical spacing (I don't think it is random)?
Not sure i really follow you, but some examples..
Well formatted HTML
Indentation used, no excessive whitespace
<div class="example1">
<div class="example2">
<div class="example3"></div>
<div class="example4"></div>
</div>
</div>
Poorly formatted HTML - Example 1
No indentation
<div class="example1">
<div class="example2">
<div class="example3"></div>
<div class="example4"></div>
</div>
</div>
Example 2
Useless whitespace
<div class="example1">
<div class="example2">
<div class="example3"></div>
<div class="example4"></div>
</div>
</div>
This isn't really specific to WordPress, any good teacher or tutorial will encourage well formatted coding, and there's little excuse when you're using a good editor(i mean seriously, which do you find most readable and easier to understand?).
More..
Well formatted PHP
Indentation used appropriately
if( something ) {
do_something()
if( some_nested_condition )
do_something_else();
}
Poorly formatted
No indentation, harder to read
if( something ) {
do_something()
if( some_nested_condition )
do_something_else();
}
Formatting your code makes it easier to read, understand, or update/maintain(it's not something that will make a whole lot of sense until you start dealing with code on a regular basis). Then again, i'm not the best at explaining these things, so i'd suggest refering to information already available for the "why".. (i know my reasons)..
Mixed PHP and HTML example
Mock template loop, only for illustration
<div class="wrapper">
<div class="header">
<h1>My Website Heading</h1>
</div>
<div class="content">
<?php if( have_posts() ) : ?>
<div class="wrapsallposts">
<?php while( have_posts() ) : the_post(); ?>
<div class="post">
<h2><?php the_title(); ?></h2>
<div class="postcontent"><?php the_content(); ?></div>
</div>
<?php endwhile; ?>
</div>
<?php endif; ?>
</div>
</div>

Page Navigation Within a Post with Specific post_type defined not working in Wordpress

http://lakers.sonikastudios.com/gallery/sample-gallery-post-1/
That post has several pages using the quicktag of Wordpress. This post is also is a custom post_type.. using the following code in the functions.php in the theme template.
add_action( 'init', 'create_post_type' );
function create_post_type() {
register_post_type( 'gallery',
array(
'labels' => array(
'name' => __( 'Galleries' ),
'singular_name' => __( 'Gallery' )
),
'public' => true,
'supports' => array('title', 'editor', 'thumbnail', 'excerpt', 'custom-fields', 'comments')
)
);
With this code, I managed to get a custom post type appearing in the admin section just fine. I added a new article there, with the page flippers..
So using the wp_link_pages() function, I got the page flipping functions working. But it only works on regular posts under the categories, but not for the posts that are defined as the 'gallery' post_type. For example, this page http://lakers.sonikastudios.com/editorials/catching-the-buss-to-the-hall-of-fame/3/ works just fine with the pagination within the post.
I'm not using any plugins that affect the post display method or navigation, and I did not mess with the .htaccess file - whatever Wordpress wrote is what I got there.
Any help would be great.. the site's almost ready and we hit this bottleneck and it's killing me!
I'm using the latest version of Wordpress, and I started development with the Whiteboard theme (the new one made for WP3). ]
UPDATED:
gallery.php (assigned via the Page module to display the post_type "gallery" - I confirmed that this is the file that loads when I load a gallery post_type post)
<?php
/*
Template Name: Gallery
*/
?>
<?php get_header();
$exclude = array();
?>
<div class="grid_11" id="mainbar">
<?php if ( have_posts() ) while ( have_posts() ) : the_post();
$exclude[]=get_the_ID();
?>
<div id="post-<?php the_ID(); ?>" <?php post_class('grid_11 alpha omega'); ?>>
<h2><? the_title();?></h2>
<div class="social_media_balloons">
<?
if (function_exists('fbshare_manual')) echo fbshare_manual();
?>
<?
if (function_exists('tweetmeme')) echo tweetmeme();
?>
</div>
<?
$author_gravatar = get_gravatar(get_the_author_meta('user_email'));
?>
<img src="<? echo $author_gravatar;?>" class="alignleft" />
<?
echo posted_by_and_category();
?>
<div class="grid_11 alpha omega">
<?php the_content(); ?>
<div id="single_article_selectors">
<?php wp_link_pages('before=<div class="single_article_selector">&after=</div>'); ?>
<?php wp_link_pages('before=<div class="single_article_selector">&after=</div>&next_or_number=next'); ?>
</div>
<div class="grid_11 alpha omega" id="social_media_links">
<div class="grid_5 alpha">
<p><img src="/images/twittericon.jpg" alt="Twitter" width="32" height="32" class="alignleft">Follow Lakers Nation </p>
<p><img src="/images/rssicon.jpg" alt="Twitter" width="32" height="32" class="alignleft">Subscribe to Lakers Nation</p>
</div>
<div class="grid_5 omega">
<p><img src="/images/fbicon.jpg" alt="Twitter" width="32" class="alignleft">Become a Fan on Facebook</p>
<p><img src="/images/iphoneicon.png" alt="Twitter" width="32" height="32" class="alignleft">Download our Free iPhone App</p>
</div>
</div>
<div class="shadow_divider"></div>
</div><!--#post-content-->
<!-- If a user fills out their bio info, it's included here -->
<div id="post-author" class="grid_11 alpha omega">
<h3>Written by <?php the_author_posts_link() ?></h3>
<div id="author-gravatar">
<!-- This avatar is the user's gravatar (http://gravatar.com) based on their administrative email address -->
<?php echo get_avatar( $curauth->user_email, $default = '<path_to_url>' ); ?>
</div><!--#author-gravatar -->
<div id="authorDescription">
<?php the_author_meta('description') ?>
<div id="author-link">
<p>View all posts by: <?php the_author_posts_link() ?></p>
</div><!--#author-link-->
</div><!--#author-description -->
</div><!--#post-author-->
</div><!-- #post-## -->
<div class="grid_11 alpha omega next_prev_links">
<div class="grid_3 alpha">
<p>
<?php previous_post_link('%link', '« Previous post') ?>
</p>
</div><!--.older-->
<div class="grid_3 omega" style="float:right; text-align:right;">
<p>
<?php next_post_link('%link', 'Next Post »') ?>
</p>
</div><!--.older-->
</div><!--.newer-older-->
<?php comments_template( '', true ); ?>
<?php endwhile; ?><!--end loop-->
</div><!--#content-->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
single.php (regular post display template by default..)
<?php get_header();
$dirpath = str_replace(get_bloginfo('url'), '',get_bloginfo('template_directory'));
?>
<div class="grid_11" id="mainbar">
<?php if ( have_posts() ) while ( have_posts() ) : the_post();
$exclude[]=get_the_ID();
?>
<div id="post-<?php the_ID(); ?>" <?php post_class('grid_11 alpha omega'); ?>>
<?
echo posted_by_single();
?>
<div class="grid_11 alpha omega">
<div id="single_post_title">
<h1><? the_title();?></h1>
</div>
<div class="social_media_balloons">
<?
if (function_exists('fbshare_manual')) echo fbshare_manual();
?>
<?
if (function_exists('tweetmeme')) echo tweetmeme();
?>
</div>
<div class="grid_11 alpha omega">
<?php the_content(); ?>
<div id="single_article_selectors">
<?php wp_link_pages('before=<div class="single_article_selector">&after=</div>'); ?>
<?php wp_link_pages('before=<div class="single_article_selector">&after=</div>&next_or_number=next'); ?>
</div>
<div class="grid_11 alpha omega" id="social_media_links">
<div class="grid_5 alpha">
<p><img src="/images/twittericon.jpg" alt="Twitter" width="32" height="32" class="alignleft">Follow Lakers Nation </p>
<p><img src="/images/rssicon.jpg" alt="Twitter" width="32" height="32" class="alignleft">Subscribe to Lakers Nation</p>
</div>
<div class="grid_5 omega">
<p><img src="/images/fbicon.jpg" alt="Twitter" width="32" class="alignleft">Become a Fan on Facebook</p>
<p><img src="/images/iphoneicon.png" alt="Twitter" width="32" height="32" class="alignleft">Download our Free iPhone App</p>
</div>
</div>
<div class="shadow_divider"></div>
</div><!--#post-content-->
</div><!-- #post-## -->
<div class="grid_11 alpha omega next_prev_links">
<div class="grid_3 alpha">
<p>
<?php previous_post_link('%link', '« Previous post') ?>
</p>
</div><!--.older-->
<div class="grid_3 omega" style="float:right; text-align:right;">
<p>
<?php next_post_link('%link', 'Next Post »') ?>
</p>
</div><!--.older-->
</div><!--.newer-older-->
<div class="grid_11 alpha omega" id="comments_container">
<?php comments_template( '', true ); ?>
</div>
</div>
<?php endwhile; ?><!--end loop-->
</div><!--#mainbar-->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
The issue your having is pagination with custom post type. There is a good thread on WordPress.org with some examples and solutions used to get it working.
A similar question has been answered already on StackOverflow
Edit:
I was not able to reproduce the error using the code you provided.
See: Custom Post Type Pagination Test
To create the test I took the following steps:
Uploaded and installed the Whiteboard theme from the themes home page
Added the sample code provided to functions.php to create the post type
Copied the code provided "Gallery Template" and renamed it single-gallery.php
(Template hierarchy looks for single-PostType.php then single.php when displaying a single post type page)
Created a new gallery by clicking gallery add new
Inserted 4 images using add media
Inserted <!--nextpage--> between each image
Saved post and updated permalinks
Test Environment
WordPress version: 3.0.1
PHP version: 5.2.13
Theme: whiteboard
Permalink: /%year%/%monthnum%/%postname%/

Resources