Skip to content

Instantly share code, notes, and snippets.

@creativembers
creativembers / gist:026ebb0a9721130b8c2b
Created October 6, 2014 18:14
Remove WordPress Admin bar on front end only - add to functions
show_admin_bar( false );
@creativembers
creativembers / html5_template.html
Last active December 27, 2015 09:59 — forked from nathansmith/html5_template.html
HTML 5 Simple Page Starter
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge, chrome=1" />
<title>untitled</title>
<link rel="stylesheet" href="" />
</head>
<body>
@creativembers
creativembers / register-post-type.php
Last active October 16, 2019 10:50 — forked from justintadlock/register-post-type.php
Register Custom Post Type
<?php
/* Register custom post types on the 'init' hook. */
add_action( 'init', 'my_register_post_types' );
/**
* Registers post types needed by the plugin.
*
* @since 0.1.0
* @access public
@creativembers
creativembers / WP Excerpts
Created August 1, 2013 03:27
Making WP blog view show only excerpts with [...] Read More
//In template change <?php the_content(); ?> to:
<?php the_excerpt(); ?>
//_________________________________________________________
// In functions.php:
// Add read more link to posts after excerpt
// Alter the widget title markup
add_filter('dynamic_sidebar_params', 'wrap_widget_titles', 20);
/**
* Wrap the widget titles - including any existing before/after title markup
* inside an extra div we can target with div.widget_title_wrapper.
*
* If we needed to do this selectively we could test against $widget['name']
* or $widget['id'].
*/
@creativembers
creativembers / vertical centering css
Last active January 12, 2020 13:09
Vertical centering with inline block and line heights, as explained by Jamy Golden at http://css-plus.com/2013/01/inline-block-the-complete-story/
.container {
height: 500px; /* Some kind of height is necessary here. */
line-height: 500px; /* This value should equal the height */
text-align: center; /* This horizontally centers the element */
background-color: #66D9EF;
}
.centered {
display: inline-block;
*display: inline; zoom: 1; /* IE7 inline-block hack */
@creativembers
creativembers / add log in button
Last active December 20, 2015 09:49 — forked from WenLiangTseng/wordpress_add_login_link_to_menu.php
Adding a dynamic log in logout link to a specific custom wordpress menu
<?php
//Add a login/logout link to your navigation menu
add_filter('wp_nav_menu_items', 'add_login_logout_link', 10, 2);
function add_login_logout_link($items, $args) {
if($args->theme_location == 'primary') {
ob_start();
wp_loginout('index.php');
$loginoutlink = ob_get_contents();