Skip to content

Instantly share code, notes, and snippets.

View jcamp's full-sized avatar

Jonathan jcamp

View GitHub Profile
// 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 / 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 ) ) ),
@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
<?php echo '<!-- ' . basename( get_page_template() ) . ' -->'; ?>
@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');
@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 / 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 / smooth-scroll.js
Created July 6, 2018 17:52 — forked from barbwiredmedia/smooth-scroll.js
Jquery smooth scroll
//Smooth scroll to member info #details
$('a[href*=#jump]').click(function() {
if (location.pathname.replace(/^\//, '') === this.pathname.replace(/^\//, '') && location.hostname === this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
if (target.length) {
$('html,body').animate({
scrollTop: target.offset().top
}, 1000);
return false;
AuthType Basic
AuthName "Password Protected Area"
AuthUserFile /your/server/path/.htpasswd
Require valid-user
@jcamp
jcamp / woocommerce-functions.php
Created July 6, 2018 17:49 — forked from barbwiredmedia/woocommerce-functions.php
Wordpress Woocommerce out of stock, backorder
//Backorder
function backordertext($available) {
foreach ($available as $i) {
$available = strreplace('Available on backorder', 'This item is currently only available for backorder. Please allow 30-45 days from time of order for delivery.', $available);
}
return $available;
}
addfilter('woocommercegetavailability', 'backordertext');