Skip to content

Instantly share code, notes, and snippets.

@eyecandy91
eyecandy91 / gist:a1b39e5be5c1fb848b3c774065e2a09e
Last active July 13, 2019 13:36
If url has a parameter jquery
jQuery(document).ready(function($) {
if (window.location.href.indexOf("?enqiury=completed") > -1) {
$("#modal").addClass("is-active");
$(".modal-close").click(function() {
$("#modal").removeClass("is-active");
});
}
});
PHP VERSION
@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
*/
$terms = get_terms('should be your taxomony');
echo '<ul>';
foreach ($terms as $term) {
echo '<li><a href="'.get_term_link($term).'">'.$term->name.'</a></li>';
}
echo '</ul>';
@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 ) :
Function -------
// Custom pagination
function pagination($pages = '', $range = 4)
{
$showitems = ($range * 2)+1;
global $paged;
if(empty($paged)) $paged = 1;
if($pages == '')
Function -------
// Custom pagination
function pagination($pages = '', $range = 4)
{
$showitems = ($range * 2)+1;
global $paged;
if(empty($paged)) $paged = 1;
if($pages == '')
@eyecandy91
eyecandy91 / gist:26e96fbdc33ded5942e3d6f64a2f61b0
Created June 26, 2019 02:31
When you cant get folders to be added to git ignore
git rm -r --cached <folder>
<?php $args = array(
'echo' => true,
'redirect' => 'http://wpsnipp.com',
'form_id' => 'loginform',
'label_username' => __( 'Username' ),
'label_password' => __( 'Password' ),
'label_remember' => __( 'Remember Me' ),
'label_log_in' => __( 'Log In' ),
'id_username' => 'user_login',
'id_password' => 'user_pass',
@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(); ?>
var $src = $('#loggedout-user'),
$dst = $('#user-name');
$src.on('input', function() {
$dst.val($src.val());
});
// OR
$('#loggedout-user').on('change', function() {
$('#user-name').val($(this).val());