Skip to content

Instantly share code, notes, and snippets.

@alexmustin
alexmustin / form-content.html
Created February 4, 2018 21:31
WordPress AJAX Live Search of Post Title
<!-- // The HTML (could be part of page content) // -->
<input type="text" name="keyword" id="keyword" onkeyup="fetch()"></input>
<div id="datafetch">Search results will appear here</div>
@About2git
About2git / functions.php
Last active September 16, 2021 18:54 — forked from srikat/functions.php
Shrinking header in Genesis similar to that in Centric Pro
//* Enqueue Scripts
add_action( 'wp_enqueue_scripts', 'custom_load_scripts' );
function custom_load_scripts() {
wp_enqueue_script( 'shrinking-header', get_bloginfo( 'stylesheet_directory' ) . '/js/shrinking-header.js', array( 'jquery' ), '1.0.0', true );
}
@yratof
yratof / admin-only.php
Last active April 6, 2020 18:29
Helpful functions for wp-members wordpress plugin
/* Stop non-admins from accessing the dashboard.
Instead, they're redirected to a custom page,
which stops them from messing with the website.
This is the url. I've added an extra page to the site_url() */
$goodbye = site_url() .'/video/videos';
function acme_login_redirect( $redirect_to, $request, $user ) {
return ( is_array( $user->roles ) && in_array( 'administrator', $user->roles ) ) ? admin_url() : $goodbye;
}
add_filter( 'login_redirect', 'acme_login_redirect', 10, 3 );
@justintadlock
justintadlock / register-post-type.php
Last active July 17, 2024 10:14
Help file when registering post types.
<?php
# Register custom post types on the 'init' hook.
add_action( 'init', 'my_register_post_types' );
/**
* Registers post types needed by the plugin.
*
* @since 1.0.0
* @access public
@wpsmith
wpsmith / genesis_site_layout.php
Last active February 9, 2022 14:40
Force Specific Layout on a page
/**** Truly Force Layout without allowing the User to Override the preferred/recommended layout ****/
// Force Full Width Layout
add_filter( 'genesis_site_layout', '__genesis_return_full_width_content' );
// Force Content-Sidebar Layout
add_filter( 'genesis_site_layout', '__genesis_return_content_sidebar' );
// Force Sidebar-Content Layout
add_filter( 'genesis_site_layout', '__genesis_return_sidebar_content' );