Skip to content

Instantly share code, notes, and snippets.

@eyecandy91
eyecandy91 / basic-dropdown-usage.php
Created December 12, 2019 05:31 — forked from joshuadavidnelson/basic-dropdown-usage.php
Filter wp_dropdown_categories by post type.
<?php
/**
* Using wp_dropdown_categories with the post type filter applied.
*
* @link https://joshuadnelson.com/category-taxonomy-dropdown-filtered-by-post-type/
*/
// Taxonomy dropdown arguments
$args = array(
'taxonomy' => 'department',
@eyecandy91
eyecandy91 / dashboard-activity-cpt.php
Created July 18, 2019 03:56 — forked from Mte90/dashboard-activity-cpt.php
Add your cpts to the Widget Activity of the Dashboard in WordPress
<?php
/*
Plugin Name: Dashboard Widget Activity Custom Post Type
Plugin URI:
Description:
Author: Daniele Mte90 Scasciafratte
Version: 1.0.0
Author URI: http://mte90.net
*/
@eyecandy91
eyecandy91 / a-cpt.php
Created June 30, 2019 14:42 — forked from neilgee/a-cpt.php
CPT (Custom Post Type) - WordPress Plugin - there are 2 snippets here - the one name - cpt-hide.php hides the single and archive views, the other one is normal
<?php
/*
Plugin Name: Testimonial Custom Post Type
Plugin URI: http://wpbeaches.com/create-custom-post-types-in-genesis-child-theme-in-wordpress/
Description: Testimonial Custom Post Types
Author: Neil Gowran
Version:1.0.0
Author URI:http://wpbeaches.com
*/
@eyecandy91
eyecandy91 / gist:76fa995017a60631c52d4d9b8a229cf8
Created June 26, 2019 14:18 — forked from DevinWalker/gist:6fb2783c05b46a2ba251
WordPress: Loop through Categories and Display Posts Within
<?php
/*
* Loop through Categories and Display Posts within
*/
$post_type = 'features';
// Get all the taxonomies for this post type
$taxonomies = get_object_taxonomies( array( 'post_type' => $post_type ) );
foreach( $taxonomies as $taxonomy ) :
@eyecandy91
eyecandy91 / loop-custom.php
Created June 20, 2019 07:42 — forked from kevinwhoffman/loop-custom.php
WordPress - Custom Post Type Loop
<?php
$loop = new WP_Query( array(
'post_type' => 'Property',
'posts_per_page' => -1
)
);
?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
@eyecandy91
eyecandy91 / gist:452beeae8f6c3e704de6c13b0ad0514d
Created April 25, 2019 03:54 — forked from govindak/gist:7435288
Get the featured image by page ID in WordPress
<?php
//page id
$page_id = "5"; //example
if (has_post_thumbnail($page_id) ):
$image = wp_get_attachment_image_src( get_post_thumbnail_id($page_id), 'single-post-thumbnail' );
endif;
$image_URI = $image[0];
@eyecandy91
eyecandy91 / toggle-menu.js
Created April 24, 2019 12:38 — forked from Bradcomp/toggle-menu.js
Toggles the .is-active class for a hamburger menu
(function() {
var burger = document.querySelector('.nav-toggle');
var menu = document.querySelector('.nav-menu');
burger.addEventListener('click', function() {
burger.classList.toggle('is-active');
menu.classList.toggle('is-active');
});
})();
@eyecandy91
eyecandy91 / Wordpress: Do if the_content is not empty
Created March 31, 2019 11:27 — forked from bhongy/Wordpress: Do if the_content is not empty
Wordpress: Check if the_content is empty / do something only when the_content is empty
<?php
$thecontent = get_the_content();
if(!empty($thecontent)) { ?>
// do or output something
<?php } ?> // break php tag for HTML block
@eyecandy91
eyecandy91 / cacert.pem
Created February 23, 2018 03:11 — forked from HTMLGuyLLC/cacert.pem
cacert.pem to create a secure connection to APIs
##
## ca-bundle.crt -- Bundle of CA Root Certificates
##
## Certificate data from Mozilla as of: Sat Dec 29 20:03:40 2012
##
## This is a bundle of X.509 certificates of public Certificate Authorities
## (CA). These were automatically extracted from Mozilla's root certificates
## file (certdata.txt). This file can be found in the mozilla source tree:
## http://mxr.mozilla.org/mozilla/source/security/nss/lib/ckfw/builtins/certdata.txt?raw=1
##
@eyecandy91
eyecandy91 / water_ripple_canvas.js
Created September 9, 2017 10:17 — forked from StuPig/water_ripple_canvas.js
Use JavaScript and canvas to create water ripple effect
/*
* Water Canvas by Almer Thie (http://code.almeros.com).
* Description: A realtime water ripple effect on an HTML5 canvas.
* Copyright 2010 Almer Thie. All rights reserved.
*
* Example: http://code.almeros.com/code-examples/water-effect-canvas/
* Tutorial: http://code.almeros.com/water-ripple-canvas-and-javascript
*/