Skip to content

Instantly share code, notes, and snippets.

@adapicom
adapicom / gist:5681209
Created May 30, 2013 21:00
Add this to your functions.php file to strip all mentioning of the Wordpress version.
/* REMOVE WORDPRESS VERSION TEXT */
function wpbeginner_remove_version() {
return ''; }
add_filter('the_generator', 'wpbeginner_remove_version');
@adapicom
adapicom / gist:5681188
Created May 30, 2013 20:59
Add this to wp-config.php file to disable core, plugin and theme updates and editing.
/** Preventing Core, Plugin and Theme Auto Updates. */
define( 'DISALLOW_FILE_EDIT', true );
define( 'DISALLOW_FILE_MODS', true );
@adapicom
adapicom / functions.php
Created May 29, 2013 21:30
Strip wpautop for Shortcodes
remove_filter( 'the_content', 'wpautop' );
add_filter( 'the_content', 'wpautop' , 99);
@adapicom
adapicom / gist:5503828
Created May 2, 2013 17:26
Input Placeholder For Older Browsers (jQuery)
<script>
// This adds 'placeholder' to the items listed in the jQuery .support object.
jQuery(function() {
jQuery.support.placeholder = false;
test = document.createElement('input');
if('placeholder' in test) jQuery.support.placeholder = true;
});
// This adds placeholder support to browsers that wouldn't otherwise support it.
$(function() {
if(!$.support.placeholder) {
@adapicom
adapicom / gist:5502655
Created May 2, 2013 14:39
Strip Images from a Wordpress Blog Post
<?php
echo preg_replace('/<img[^>]+./','',get_the_content());
?>
@adapicom
adapicom / gist:4742632
Created February 8, 2013 22:55
WP IF ELSE by Post or Page Array
<?php if (is_single(array(459,16,21))) { ?>
<!-- put code here -->
<?php } else { ?>
<!-- put code here -->
<?php } ?>
@adapicom
adapicom / custommenu
Last active December 11, 2015 06:38
Adds custom menu support to a Wordpress theme
<?php wp_nav_menu( array('menu' => 'Blog Menu' )); ?>
@adapicom
adapicom / ifcustomfield.php
Created October 13, 2012 16:58
Print Custom Field IF Custom Field Exists
<?php if(get_post_meta($post->ID, 'single-bottom-ad', true)): ?>
<div id="single-bottom-ad">
<?php echo get_post_meta($post->ID, 'single-bottom-ad', true); ?>
</div>
<?php endif; ?>
@adapicom
adapicom / querypostsexclude.php
Created September 20, 2012 17:49
WP Query Posts Exclude Category
<?php query_posts('cat=-6&showposts=8'); ?>
<?php while (have_posts()) : the_post(); ?>
<?php endwhile;?>
@adapicom
adapicom / queryspecificcat.php
Created September 20, 2012 17:49
WP Query Posts Specific Category
<?php query_posts('cat=6&showposts=1'); ?>
<?php while (have_posts()) : the_post(); ?>
<?php endwhile;?>