Skip to content

Instantly share code, notes, and snippets.

@adapicom
adapicom / getcustomfield.php
Created February 3, 2012 18:19
WP: Get Custom Field
<?php echo get_post_meta($post->ID, 'name_of_key_here', true) ?>
@adapicom
adapicom / contact7placeholder.php
Created February 7, 2012 00:00
Add placeholder capabilities to Contact7 WP Plugin
//Add the following code into text.php and textarea.php just above the line that says
//if ( wpcf7_script_is() && $value && preg_grep( '%^watermark$%', $options ) ) {):
$ph_att = '';
if ( $value && preg_grep( '%^placeholder$%', $options ) ) {
$ph_att .= sprintf( ' %s', $value );
$value = '';
}
@adapicom
adapicom / shortcode_template.php
Created March 16, 2012 22:41
Wordpress: Using shortcodes inside templates
<?php echo do_shortcode('[shortcode]whatever[/shortcode]'); ?>
@adapicom
adapicom / remove_wp_toolbar.php
Created March 22, 2012 23:00
Remove Wordpress User Toolbar Sitewide
add_filter( 'show_admin_bar', '_return_false' );
@adapicom
adapicom / wpifelse.php
Created July 13, 2012 20:19
Simple Wordpress PHP If Else for Posts and Pages by ID
<?php if (is_single('11')) { ?>
<!-- put code here -->
<?php } else { ?>
<!-- put code here -->
<?php } ?>
@adapicom
adapicom / gaoubound.html
Created July 16, 2012 20:20
Google Analytics: Tracking Outbound Clicks
onClick="_gaq.push(['_trackEvent', 'Partner', 'Creditrepair', 'Homepage']);"
onClick="_gaq.push(['_trackEvent', 'Partner', 'Creditrepair', 'Companypage']);"
@adapicom
adapicom / tweetit.html
Created July 29, 2012 22:00
Tweet Links Inside Blog Posts
<a href="http://twitter.com/home/?status='There are two rules for success. 1) Never tell everything you know.' – Roger H. Lincoln http://14click.me/equotesu" target=”_blank”>[tweet it]</a>
@adapicom
adapicom / wpifelse.php
Created September 12, 2012 21:09
WP IF ELSE Based on parent URL
<?php if (stripos($_SERVER['REQUEST_URI'],'/us/') !== false) { ?>
<?php } else { ?>
<address>Call Us Today <p>(800) 486-1866</p></address>
<?php } ?>
@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;?>
@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;?>