Skip to content

Instantly share code, notes, and snippets.

@neilgee
neilgee / image.php
Created September 18, 2018 08:35
Link Featured Image to Linked Media Image
<?php
// Create the variable for the large image src link
$large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large' );
// Out the Post Title Using the post permalink for the post link - then the image which links to its large size
?>
<h3><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
@neilgee
neilgee / functions.php
Created September 15, 2018 03:41
Filter CPT by Custom Taxonomy in WP Dashboard
<?php // <~ don't add me in
add_action( 'restrict_manage_posts', 'filter_backend_by_taxonomies' , 99, 2);
/* Filter CPT via Custom Taxonomy */
/* https://generatewp.com/filtering-posts-by-taxonomies-in-the-dashboard/ */
function filter_backend_by_taxonomies( $post_type, $which ) {
// Apply this to a specific CPT
if ( 'light' !== $post_type )
@neilgee
neilgee / functions.php
Created September 14, 2018 07:27
Modern Tribe Events Date Output
<?php // <~ don't add me in
add_shortcode( 'all_the_single_dates', 'all_the_single_dates' );
// Event Dates - display single date only for single dates & multi dates for multiple day events
function all_the_single_dates() {
// Get the start date and end date
// https://pastebin.com/ij0g9Tcf
// https://theeventscalendar.com/support/forums/topic/remove-end-date-if-same-as-start-date/#post-46651
ob_start();
@neilgee
neilgee / relationship-output.php
Created August 6, 2018 06:29
ACF Relationship Code
<?php //<~ don't add me
add_shortcode( 'tl_related_lights', 'tl_related_lights_relationship' );
// Add Relationship ACF field between Projects and Lights
function tl_related_lights_relationship() {
ob_start();
$posts = get_field('tl_project_lights_link_used');
if( $posts ): ?>
This file has been truncated, but you can view the full file.
/usr/sbin/mysqld, Version: 5.7.21-0ubuntu0.16.04.1-log ((Ubuntu)). started with:
Tcp port: 3306 Unix socket: /var/run/mysqld/mysqld.sock
Time Id Command Argument
# Time: 2018-04-11T23:22:58.672420Z
# User@Host: vultr_cgp[vultr_cgp] @ localhost [] Id: 234324
# Query_time: 0.152190 Lock_time: 0.031670 Rows_sent: 0 Rows_examined: 0
use vultr_cgp;
SET timestamp=1523488978;
SELECT option_value FROM wp_options WHERE option_name = '_transient_timeout_jetpack_idc_allowed' LIMIT 1;
# Time: 2018-04-11T23:22:58.698142Z
@neilgee
neilgee / accordion-menu.js
Created May 2, 2018 04:50
WooCommerce Product Category Accordion Menu
// Category Accordion
// Example - http://dev.rose.websitelove.com.au/shop/
if ($('.wgs-side-woo ul.product-categories').length > 0) {
var lcP = $('.wgs-side-woo li.cat-parent'), lcPF = $('.wgs-side-woo li.cat-parent.cat-item-2204');
var lcPC = $('.wgs-side-woo li.current-cat'), lcPCP = $('.wgs-side-woo li.current-cat-parent');
lcP.prepend('<span class="toggle"><i class="fa fa-minus-square-o fa-plus-square-o"></i></span>');
lcP.parent('ul').addClass('has-toggle'); lcP.children('ul').hide();
if (lcP.hasClass("current-cat-parent")) {
lcPCP.addClass('open'); lcPCP.children('ul').show(); lcPCP.children().children('i.fa').removeClass('fa-plus-square-o');
} else if (lcP.hasClass("current-cat")) {
@neilgee
neilgee / html.html
Last active May 2, 2018 04:39
Slide Toggle 2 Rows in BB
<ul class="list-buttons">
<li class="active"> <a id="showall">Show All</a></li>
<li><a class="showSingle" target="1">Show Classes</a></li>
<li><a class="showSingle" target="2">Show Treatments</a></li>
</ul>
<!-- Rows -->
<div id="div1" class="primary-row">...</div>
@neilgee
neilgee / anchorlinks.js
Last active May 18, 2018 18:37
Anchor offset links from one page to another offsetting a fixed header
@neilgee
neilgee / class-product-cat-list-walker.php
Last active September 16, 2021 14:17
WooCommerce Product Category Menu Walker Class
<?php
/**
* WC_Product_Cat_List_Walker class
*
* @extends Walker
* @class WC_Product_Cat_Dropdown_Walker
* @version 2.3.0
* @package WooCommerce/Classes/Walkers
* @author WooThemes
*/
@neilgee
neilgee / acf-rs2.php
Last active July 11, 2023 03:13
Relationship Field ACF as Shortcode
<?php //<~ don't add me in
add_shortcode( 'tl_related_lights', 'tl_related_lights_relationship' ); // Add your shortcode here
// Add Relationship field between same CPT
function tl_related_lights_relationship() {
ob_start();
$posts = get_field('relationship_field_name'); // Add your ACF field in here