Skip to content

Instantly share code, notes, and snippets.

View bhubbard's full-sized avatar
:octocat:
Hello

Brandon Hubbard bhubbard

:octocat:
Hello
View GitHub Profile
@bhubbard
bhubbard / gist:ca31c1dfbf10f14122fc
Last active September 8, 2015 23:28
CloudFlare SSL - Jetpack Possible Fixes
/**
https://jeremy.hu/cloudflare-flexible-ssl-wordpress/
* https://wordpress.org/support/topic/similar-posts-httpsssl
* https://wordpress.org/support/topic/it-cant-connect-my-wordpress-on-openshiftcom-to-wordpresscom
* http://ttmm.io/tech/securing-xml-rpc-wordpress/
* https://felicianotech.com/blog/running-wordpress-behind-an-sslhttps-terminating-proxy/
* https://wordpress.org/support/topic/publicize-error-code-32700
*/
@bhubbard
bhubbard / carousel-loop.php
Last active September 10, 2016 17:35 — forked from nbeers22/carousel-loop.php
Bootstrap carousel with WordPress loop
@bhubbard
bhubbard / pager.php
Last active September 27, 2015 15:03 — forked from metinsaylan/pager.php
Bootstrap pager links for WordPress single.php template
<?php
// This template can be included in your single.php template to display <Previous-Next> links below your post.
// It uses aligned pager template stated here > http://getbootstrap.com/components/#aligned-links
?>
<nav>
<ul class="pager">
<?php
$post_permalink = get_permalink();
$previous_post = get_permalink(get_adjacent_post(false,'',false));
@bhubbard
bhubbard / gist:2befadc1ad986aaded63
Last active September 11, 2015 16:31 — forked from wcodex/gist:8825693
Custom WordPress search form using bootstrap 3.0
?>
<form class="navbar-form" role="search" action="<?php echo site_url('/'); ?>" method="get" >
<div class="input-group">
<input type="text" class="form-control" placeholder="Search" name="s" id="search" value="<?php the_search_query(); ?>">
<div class="input-group-btn">
<button class="btn btn-default" type="submit"><i class="glyphicon glyphicon-search"></i></button>
</div>
</div>
</form>
define("GF_THEME_IMPORT_FILE", "http://www.domain.com/path/to/gf_import.xml");
define("GF_LICENSE_KEY", "YOUR-LICENSE-KEY-HERE");
// Gravity Forms - Recaptcha Keys
define("GF_RECAPTCHA_PUBLIC_KEY", "YOUR-KEY-HERE");
define("GF_RECAPTCHA_PRIVATE_KEY", "YOUR-KEY-HERE");
// Default Import Forms
@bhubbard
bhubbard / wordpress-site-bg-image-override.php
Created October 8, 2015 17:36
Jetpack grabs the Custom Header image data from the header_image_data theme mod, so you should be able to overwrite that value, even if Custom Header support isn't defined in your theme, with something like this:
<?php
function jeherve_my_default_header_image() {
$header_img = esc_url( 'https://jeherve.com/wp-content/uploads/2015/10/7.jpg' );
$header_img_data = array(
'attachment_id' => '1681',
'url' => $header_img,
'thumbnail_url' => $header_img,
'height' => '198',
@bhubbard
bhubbard / cloudflare-dev-mode.js
Last active October 9, 2015 22:44 — forked from chrisblakley/cloudflare-dev-mode.js
This is a more complete Cloudflare admin bar functionality. Can definitely be more optimized, but it gets the idea across.
function cloudflareDevModeToggle(toggle){
if ( !toggle ){
toggle = 'on';
}
jQuery('.devmodeicon').removeClass('fa-bolt fa-medkit').addClass('fa-spin fa-spinner');
jQuery.ajax({
type: "POST",
url: bloginfo["admin_ajax"],
@bhubbard
bhubbard / 01 - Theme Testing Process.markdown
Created October 27, 2015 22:17 — forked from AlphaGit/01 - Theme Testing Process.markdown
Theme testing process (from Wordpress Codex)

Theme Testing Process

from Theme Development (Wordpress Codex)

  • Fix PHP and WordPress errors. Add the following debug setting to your wp-config.php file to see deprecated function calls and other WordPress-related errors: define('WP_DEBUG', true);. See Deprecated Functions Hook for more information.
  • Check template files against Template File Checklist.
  • Do a run-through using the Theme Unit Test.
  • Validate HTML and CSS. See Validating a Website.
  • Check for JavaScript errors.
  • Test in all your target browsers. For example, IE7, IE8, IE9, Safari, Chrome, Opera, and Firefox.
  • Clean up any extraneous comments, debug settings, or TODO items.
<?php
function idxbroker_dynamic_wrapper_css_tag() {
if ( 'idx-wrapper' == get_post_type() ) {
echo "\n<!-- IDX CSS -->\n\n"; // IDX Broker detection comment
}
}
add_action('wp_print_styles', 'idxbroker_dynamic_wrapper_css_tag');
<?php
function idxbroker_wrapper_hide_adminbar() {
if ( 'idx-wrapper' == get_post_type() ) {
// Adminbar
show_admin_bar( false ); // Disable WordPress Adminbar
wp_dequeue_style('admin-bar'); // Remove Adminbar CSS
wp_dequeue_script('admin-bar'); // Remove Adminbar JS