View force-style.php
//ADD THIS TO YOUR functions.php FILE
//REMOVES VERSION NUMBERS AND REPLACES WITH A RANDOM NUMBER SO STYLE SHEET RELOADS EVERY TIME
function remove_replace_css_ver( $src ) {
if ( strpos( $src, 'ver=' ) )
$src = remove_query_arg( 'ver', $src );
$newsrc = $src . '?ver=' . rand(111,9999);
return $newsrc;
}
add_filter( 'style_loader_src', 'remove_replace_css_ver', 9999 );
View wordpress-remove-quick-edit-categories.php
//REMOVE TAX IN QUICK EDITOR
add_action('admin_head', 'no_tax_display');
function no_tax_display(){
$user = wp_get_current_user();
if ( in_array( 'author', (array) $user->roles ) ) {
echo '<style>
.inline-edit-categories, #acf-form-data {
display: none;
}
</style>';
View wordpress-logout-redirect.php
//AUTHOR LOGOUT
add_filter( 'logout_url', 'author_logout_page', 10, 2 );
function author_logout_page( $logout_url, $redirect ) {
$user = wp_get_current_user();
if ( in_array( 'author', (array) $user->roles ) ) {
return home_url( '/members-home/' );
}
}
View wp-post-thumbnail-after-paragraph.php
<?php get_header(); ?>
<div>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<h1><?php the_title(); ?></h1>
<?php
$after_p_img = 1;
$content = apply_filters('the_content', $post->post_content);
if(substr_count($content, '<p>') > $after_p_img){
$contents = explode("</p>", $content);
$p_count = 1;
View wp-display-cpt-by-term.php
<?php get_header(); ?>
<h1><?php post_type_archive_title(); ?></h1>
<!-- Set Up Page Anchors -->
<div>
<ul>
<li>Jump to:</li>
<?php
$custom_terms = get_terms('termname'); // Taxonomy
foreach($custom_terms as $custom_term) {
$anchor = $custom_term->slug;
View wp-nav-menu-no-div-no-ul.php
<?php
//REMOVE DIV and UL FROM WP_NAV_MENU
function wp_nav_menu_header(){
$options = array(
'echo' => false,
'container' => false,
'theme_location' => 'header-menu',
'fallback_cb'=> 'fall_back_menu'
);
View wp-editor-user-access.php
<?php
// ADD USER PERMISIONS FOR EDITOR
function add_theme_caps() {
$role = get_role( 'editor' );
$role->add_cap( 'edit_users' );
$role->add_cap( 'delete_users' );
}
add_action( 'admin_init', 'add_theme_caps');
// EDITOR CAN'T DELETE ADMIN USERS
View wp-simple-membership-dynamic-register.php
<div class="registration">
<h2 class="title">Register Here:</h2>
<script type="text/javascript">
$(document).ready(function(){
var hideAll = function() {
$('div[class^=option]').hide();
}
$('#select').on('change', function() {
hideAll();
var category = $(this).val();
View wp-page-has-children-conditional.php
<?php get_header(); ?>
<?php
if (have_posts()) : while (have_posts()) : the_post();
$pid = get_the_ID();
$args = array(
'post_parent' => $pid,
'post_type' => 'page', // Change as per post type
'numberposts' => -1,
'post_status' => 'publish'
);
View wp_auto_page_children.php
<?php
//AUTO ADD WORDPRESS POST CHILDREN
function add_page_children( $post_id ) {
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
return;
if ( !wp_is_post_revision( $post_id )
&& 'page' == get_post_type( $post_id ) // Change as per required post type
&& 'auto-draft' != get_post_status( $post_id ) ) {
$thispage = get_post( $post_id );
$ptitle = $thispage->post_title; // Set the Parent Page title as a variable to add to new pages