$ mysqlcheck -c database_name table_name -u root -p
This file contains hidden or 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 | |
/* Convo Custom Feed API | |
* | |
* This is the PHP version of the python example script Convo offers on their website: | |
* https://www.convo.com/developer_center/api/imported_feed_api.py | |
*/ | |
function add_link_in_feed($resource_id, $url, $title, $description, $image, $site_name) { | |
global $access_key_id, $secret_access_key; | |
$params = http_build_query(['resource_id' => $resource_id, 'url' => $url, 'title' => $title, 'description' => $description, 'image' => $image, 'site_name' => $site_name ]); |
This file contains hidden or 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
#!/bin/bash | |
# This script creates a new project (or site) under /var/sites and creates | |
# new virtual host for that site. With the options a site can also | |
# install the latest version of Laravel directly. | |
# This script was originally based on the following script by @Nek from | |
# Coderwall: https://coderwall.com/p/cqoplg | |
# Display the usage information of the command. | |
create-project-usage() { |
This file contains hidden or 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 | |
//[random_testimonial] | |
function random_testimonial_func( $atts ){ | |
$query = new WP_Query( array ( 'category__in' => array( 4 ), 'posts_per_page' => -1, 'ignore_sticky_posts' => 1, ) ); | |
$testimonials = array(); | |
while( $query->have_posts() ) : $query->the_post(); | |
$testimonials[] = get_the_content(); | |
endwhile; |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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); |
NewerOlder