Skip to content

Instantly share code, notes, and snippets.

View taciara's full-sized avatar
🏠
Working from home

Taciara Furtado taciara

🏠
Working from home
View GitHub Profile
@helen
helen / wp-chosen-tax-metabox.php
Last active April 24, 2022 02:25
Use Chosen for a replacement WordPress taxonomy metabox
<?php
/**
* WordPress Chosen Taxonomy Metabox
* Author: Helen Hou-Sandi
*
* Use Chosen for a replacement taxonomy metabox in WordPress
* Useful for taxonomies that aren't changed much on the fly and are
* non-hierarchical in nature, as Chosen is for flat selection only.
* You can always use the taxonomy admin screen to add/edit taxonomy terms.
* Categories need slightly different treatment from the rest in order to
@landru247
landru247 / WP: PHP - Order a query by ACF date picker
Created July 26, 2013 14:11
WP: PHP - Order a query by ACF date picker
<?php
//Order a query by ACF date picker
$event = get_posts(array(
'post_type' => 'events',
'posts_per_page' => 4,
'meta_key' => 'event_date', // name of custom field
'orderby' => 'meta_value_num',
'order' => 'ASC'
));
if ($event) {
@wpexplorer
wpexplorer / wordpress-remove-post-type-slug
Last active October 7, 2022 01:27
Remove Custom Post Type Slug
<?php
/**
* Remove the slug from published post permalinks for our custom post types.
*/
add_filter( 'post_type_link', function( $post_link, $post, $leavename ) {
$post_types = array(
'post_type_1',
'post_type_2'
);
@jtmalinowski
jtmalinowski / jquery.fullPage.js
Created August 14, 2014 22:38
jquery.fullPage.js with horizontal wheel-scrolling, it has some other changes too, so diff against original one to see what has changed
/**
* fullPage 2.0.9
* https://github.com/alvarotrigo/fullPage.js
* MIT licensed
*
* Copyright (C) 2013 alvarotrigo.com - A project by Alvaro Trigo
*/
(function($) {
$.fn.fullpage = function(options) {
@vielhuber
vielhuber / .htaccess
Last active February 24, 2023 06:01
Apache: htaccess force www and https ssl #server
# force HTTPS and www.
RewriteEngine On
RewriteCond %{HTTP_HOST} (?!^www\.)^(.+)$ [OR]
RewriteCond %{HTTPS} off
RewriteRule ^ https://www.%1%{REQUEST_URI} [R=301,L]
# alternative way
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\. [NC]
@kodie
kodie / is_page.js
Created September 11, 2015 18:10
is_page function in jQuery for Wordpress
function is_page($pageid) {
if (jQuery('body').hasClass('page-id-'+$pageid)) { return true; } else { return false; }
}
@kellenmace
kellenmace / remove-custom-post-type-slug-from-permalinks-2.php
Last active July 2, 2023 16:18
Remove custom post type slug from permalinks 2
<?php
/**
* Have WordPress match postname to any of our public post types (post, page, race).
* All of our public post types can have /post-name/ as the slug, so they need to be unique across all posts.
* By default, WordPress only accounts for posts and pages where the slug is /post-name/.
*
* @param $query The current query.
*/
function gp_add_cpt_post_names_to_main_query( $query ) {
@koentjuh1
koentjuh1 / jQuery if window width is between.js
Created March 14, 2016 11:26
jQuery if window width is between
$(document).ready(function(){
if ( $(window).width() > 480 && $(window).width() < 768) {
} else{
}
});
@amboutwe
amboutwe / yoast_seo_sitemap_add_custom_type.php
Last active June 20, 2024 17:18
Filters and example code for Yoast SEO sitemaps
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Create a Yoast SEO sitemap for a custom post type
* Credit: Team Yoast
* Last Tested: Unknown
* Documentation: https://developer.yoast.com/features/xml-sitemaps/api/#add-a-custom-post-type
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* HOW TO USE
* Replace TYPE with your custom type
@rniswonger
rniswonger / wp-disable-plugin-update.php
Last active January 3, 2024 15:21
WordPress - Disable specific plugin update check
/**
* Prevent update notification for plugin
* http://www.thecreativedev.com/disable-updates-for-specific-plugin-in-wordpress/
* Place in theme functions.php or at bottom of wp-config.php
*/
function disable_plugin_updates( $value ) {
if ( isset($value) && is_object($value) ) {
if ( isset( $value->response['plugin-folder/plugin.php'] ) ) {
unset( $value->response['plugin-folder/plugin.php'] );
}