View rest-endpoints-filter.php
<?php
add_action( 'rest_endpoints', function( $endpoints ){
if( isset( $endpoints[ '/wp/v2/posts' ] ) ){
foreach( $endpoints[ '/wp/v2/posts' ] as &$post_endpoint ){
if( ! empty( $post_endpoint[ 'methods' ] ) && 'GET' == $post_endpoint[ 'methods' ] ){
$post_endpoint[ 'args' ][ 'type' ] = array(
'description' => 'Post types',
'type' => 'array',
'required' => false,
'default' => 'post'
View get-posts.php
<ul>
<?php
global $post;
$args = array( 'numberposts' => 5, 'post_type' => 'article' );
$myposts = get_posts( $args );
foreach( $myposts as $post ) :
setup_postdata($post); ?>
<li>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a><br />
<?php the_excerpt();?>
View instagram-scraper.php
<?php
/**
* Instagram scraper
*
* Quick and dirty Instragram scraper for displaying a Instagram feed.
*
* Based on : https://gist.github.com/cosmocatalano/4544576
*
* @param string $username Instagram user account
View shortcode.js
jQuery(document).ready(function($) {
tinymce.create( 'tinymce.plugins.dbdb_social_button', {
/**
* Initializes the plugin, this will be executed after the plugin has been created.
* This call is done before the editor instance has finished its initialization so use the onInit event
* of the editor instance to intercept that event.
*
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
View filter_acatw_allowed_taxonomies.php
<?php
/**
* This will ADD a custom taxonomy to the allowed taxonomies used by the widget
* */
function filter_acatw_allowed_taxonomies( $taxonomies ){
$taxonomies['project_category']= 'Project Categories';
return $taxonomies;
}
View hide-wp-status-links.php
View random-post-tags.php
<?php
$args = array(
'taxonomy' => 'post_tag',
'hide_empty' => 0
);
$tags = get_terms( $args );
$class_name = 'my-custom-class-name';
if ( ! empty( $tags ) && ! is_wp_error( $tags ) ) {
shuffle( $tags );
View bootstrap-link-pages.php
View resize-div-on-keyup.js
(function ($) {
'use strict';
function change_avatar_div( e ){
var field = $(e.currentTarget);
var acw_avatar_div = field.closest('.acw-thumb-size-wrap').find('.acw-avatar');
if( acw_avatar_div.length ) {
var icon = $( '.acw-icon', acw_avatar_div);
View recent-grouped-comments.sql
SELECT c.*
FROM `dbdb`.`wp_comments` c
LEFT JOIN `dbdb`.`wp_comments` c2 ON c.comment_post_ID = c2.comment_post_ID AND c.comment_date_gmt < c2.comment_date_gmt
JOIN `dbdb`.`wp_posts` ON `dbdb`.`wp_posts`.ID = c.comment_post_ID
WHERE c2.comment_date_gmt is NULL
AND ( c.comment_approved = '1' )
AND c.comment_type NOT IN ('pingback', 'trackback')
AND `dbdb`.`wp_posts`.post_status IN ('publish')
AND `dbdb`.`wp_posts`.post_type IN ('post')
ORDER BY c.comment_date_gmt DESC