$ mysqlcheck -c database_name table_name -u root -p
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Infinite next and previous post looping in WordPress | |
*/ | |
if( get_adjacent_post(false, '', true) ) { | |
previous_post_link('%link', '← Previous Post'); | |
} else { | |
$first = new WP_Query('posts_per_page=1&order=DESC'); $first->the_post(); | |
echo '<a href="' . get_permalink() . '">← Previous Post</a>'; | |
wp_reset_query(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Get first paragraph from a WordPress post. Use inside the Loop. | |
* | |
* @return string | |
*/ | |
function get_first_paragraph(){ | |
global $post; | |
$str = wpautop( get_the_content() ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
</php | |
/** | |
* Facebook Page Feed Parser | |
* | |
* @using cURL | |
*/ | |
function fb_parse_feed( $page_id, $no = 5 ) { | |
// URL to the Facebook page's RSS feed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function bg_recent_comments($no_comments = 10, $comment_len = 35) { | |
global $wpdb; | |
$request = "SELECT * FROM $wpdb->comments"; | |
$request .= " JOIN $wpdb->posts ON ID = comment_post_ID"; | |
$request .= " WHERE comment_approved = '1' AND post_status = 'publish' AND post_password =''"; | |
$request .= " ORDER BY comment_date DESC LIMIT $no_comments"; | |
$comments = $wpdb->get_results($request); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//keep element in view | |
(function($) | |
{ | |
$(document).ready( function() | |
{ | |
var elementPosTop = $('#sidebar-ads').position().top; | |
$(window).scroll(function() | |
{ | |
var wintop = $(window).scrollTop(), docheight = $(document).height(), winheight = $(window).height(); | |
//if top of element is in view |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Usage: | |
$frag = new CWS_Fragment_Cache( 'unique-key', 3600 ); // Second param is TTL | |
if ( !$frag->output() ) { // NOTE, testing for a return of false | |
functions_that_do_stuff_live(); | |
these_should_echo(); | |
// IMPORTANT | |
$frag->store(); | |
// YOU CANNOT FORGET THIS. If you do, the site will break. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* A pagination function | |
* @param integer $range: The range of the slider, works best with even numbers | |
* Used WP functions: | |
* get_pagenum_link($i) - creates the link, e.g. http://site.com/page/4 | |
* previous_posts_link(' « '); - returns the Previous page link | |
* next_posts_link(' » '); - returns the Next page link | |
*/ | |
function da_pagination( $range = 4, $wrap = true ){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
./configure \ | |
--prefix=/usr \ | |
--mandir=/usr/share/man \ | |
--infodir=/usr/share/info \ | |
--sysconfdir=/private/etc \ | |
--with-apxs2=/usr/sbin/apxs \ | |
--enable-cli \ | |
--with-config-file-path=/etc \ | |
--with-libxml-dir=/usr \ | |
--with-openssl=/usr \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> | |
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> | |
<link rel='stylesheet' href='styles.css' type='text/css' media='all' /> |
NewerOlder