Skip to content

Instantly share code, notes, and snippets.

View jcamp's full-sized avatar

Jonathan jcamp

View GitHub Profile
@jcamp
jcamp / multisite-conditional.php
Created July 6, 2018 17:54 — forked from barbwiredmedia/multisite-conditional.php
Wordpress Multisite body class addition and blog conditional.
<?php global $blog_id; ?>
<?php if ($blog_id == 2) { ?>
<?php } elseif ($blog_id == 1) { ?>
<?php } ?>
// Add site-id class to body functions.php
add_filter('body_class', 'multisite_body_classes');
function multisite_body_classes($classes) {
$id = get_current_blog_id();
@jcamp
jcamp / admin_notice.php
Created July 6, 2018 17:54 — forked from barbwiredmedia/admin_notice.php
Wordpress admin notice added to functions. Classes include: updated - green , error - red, update-nag - yellow http://codex.wordpress.org/Plugin_API/Action_Reference/admin_notices To create dismissable notices: http://wptheming.com/2011/08/admin-notices-in-wordpress/
function my_admin_notice() {
?>
<div class="error">
<p><?php _e( '3/13/2013 - ATTENTION! Please do not update the Custom Post Type UI Plugin. Versions 1.0.4. and lower are causing issues with content disappearing. Version 0.9.5 is stable and should remain active until futher notice. Please contact support with any questions.', 'my-text-domain' ); ?></p>
</div>
<?php
}
add_action( 'admin_notices', 'my_admin_notice' );
@jcamp
jcamp / wp-config.php
Created July 6, 2018 17:55 — forked from barbwiredmedia/wp-config.php
Wordpress wp-config for local/dev live /production. Uses local credentials and live credentials when appropriate.
if (file_exists(dirname(__FILE__) . '/local.php')) {
// Local Environment
define('WP_ENV', 'development');
//define('WP_DEBUG', true);
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'name');
<?php echo '<!-- ' . basename( get_page_template() ) . ' -->'; ?>
@jcamp
jcamp / resize.js
Created July 6, 2018 17:57 — forked from barbwiredmedia/resize.js
Change Tabs to select box with options for mobile screens : http://jsfiddle.net/LACnj/
$(document).ready(function () {
$(window).resize(responsive);
$(window).trigger('resize');
});
function responsive () {
// get resolution
@jcamp
jcamp / paginate.php
Created July 6, 2018 17:57 — forked from barbwiredmedia/paginate.php
Wordpress pagination - paginate links http://codex.wordpress.org/Function_Reference/paginate_links No plugins required. Minor styling needed OR used bootstrap assitance: http://www.ordinarycoder.com/paginate_links-class-ul-li-bootstrap/
<?php echo paginate_links( $args ); ?>
<!--OR-->
<?php
//custom paginaiton with styling from bootstrap
function custom_pagination() {
global $wp_query;
$big = 999999999; // need an unlikely integer
$pages = paginate_links( array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
// modifys contact form 7's default select value of --- to Please select...
function my_wpcf7_form_elements($html) {
$text = 'Please select...';
$html = str_replace('<option value="">---</option>', '<option value="">' . $text . '</option>', $html);
return $html;
}
add_filter('wpcf7_form_elements', 'my_wpcf7_form_elements');
// Modify multiple selects - Target each one specifically
function my_wpcf7_form_elements($html) {
@jcamp
jcamp / telephone.css
Created July 6, 2018 17:58 — forked from barbwiredmedia/telephone.css
Telephone attribute selector for click to call coloring on mobile device. Fixes phone number anchor color on phone
a[href^="tel"], a[href^="tel"]:visited, a[href^="tel"]:active, a[href^="tel"]:hover {color:inherit; cursor: text;}
a[href^="tel"]:hover {text-decoration: none;}
@jcamp
jcamp / template.php
Created July 6, 2018 17:58 — forked from barbwiredmedia/template.php
Wordpress: H1 headlines on different pages.Single / singular / archive
<h1>
<?php if (is_singular('your_cpt') || is_archive('your_cpt') || is_post_type_archive('your_cpt') ) { ?>
YOUR CPT NAME
<?php } elseif (is_search()) { ?>
Search
<?php } elseif (is_404()) { ?>
Error 404
<?php } else { ?>
<?php the_field('headline_text'); ?>
<?php } ?>
@jcamp
jcamp / functions.php
Created July 6, 2018 17:59 — forked from barbwiredmedia/functions.php
Wordpress custom admin login screen, logo, and stylesheet
// Create custom login
// redirects to a custom stylsheet
function custom_login_css() {
echo '<link rel="stylesheet" type="text/css" href="'.get_stylesheet_directory_uri().'/assets/css/style-login.css" />';
}
add_action('login_head', 'custom_login_css');
// Change the tool tip