Skip to content

Instantly share code, notes, and snippets.

View celticwebdesign's full-sized avatar

Darren Stevens celticwebdesign

View GitHub Profile
@celticwebdesign
celticwebdesign / WordPress Pagination
Created August 26, 2015 16:16
Used on main archive page.
// functions.php
// Pagination for paged posts, Page 1, Page 2, Page 3, with Next and Previous Links, No plugin
function html5wp_pagination()
{
global $wp_query;
$big = 999999999;
echo paginate_links(array(
'base' => str_replace($big, '%#%', get_pagenum_link($big)),
'format' => '?paged=%#%',
$taxonomy = 'blog-category';
$terms = get_terms(
$taxonomy,
array(
'hide_empty' => 1,
'parent' => 0
)
);
// 'parent' => 0
if ($terms) {
<?php
$args = array(
'post_type' => 'notices-mariners',
'post_status' => 'publish',
'posts_per_page' => 2,
'meta_key' => 'mariners_date_selected',
'orderby' => 'meta_value_num',
'order' => 'ASC'
);
HTML ----
<?php
// slideshow
$rows = get_field('slideshow_repeater');
if($rows) {
echo "<!-- slideshow -->
<div id='slideshow' class='full-width clearfix'>
/* ------------------------------------
Gravity Forms Bootstrap
Help from https://gist.githubusercontent.com/DevinWalker/7110951/raw/8f6863c52df3cc0d627bb1e18e9cb832b5ecf395/gravity-forms_bootstrap
https://wordpress.org/plugins/gravity-forms-bootstrap-3-style/
---------------------------------------*/
.gform_wrapper ul{padding-left:0;list-style:none}.gform_wrapper li{margin-bottom:15px}.gform_wrapper form{margin-bottom:0}.gform_wrapper .gfield_required{padding-left:1px;color:#b94a48}.ginput_container input,.ginput_container select,.ginput_container textarea, #theme-my-login input{display:block;width:100%;height:34px;padding:6px 12px;font-size:14px;line-height:1.428571429;color:#555;vertical-align:middle;background-color:#fff;border:1px solid #ccc;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-webkit-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s}.gin
@celticwebdesign
celticwebdesign / gist:0038f3a69e863492dbef
Created November 22, 2015 11:31
WordPress Title - CPT / WPML / Yoast SEO
<?php if(is_post_type_archive('service')):
if( ICL_LANGUAGE_CODE == "zh-hans" ) {
// $language = "chinese";
$page = 336;
} else {
// $language = "english";
$page = 95;
}
echo "<title>".get_post_meta($page, '_yoast_wpseo_title', true)."</title>";
elseif(is_post_type_archive('testimonial')):
@celticwebdesign
celticwebdesign / Gravity Forms confirmation styling
Created December 5, 2015 13:59
Gravity Forms confirmation styling
#gforms_confirmation_message_1 {
border-bottom: 1px solid #a5c199;
border-top: 1px solid #a5c199;
margin: 40px auto;
}
#gform_confirmation_wrapper_1 {
padding: 10px 0;
background: #dff0d8 none repeat scroll 0 0;
}
#gform_confirmation_message_1 {
@celticwebdesign
celticwebdesign / WordPress remove admin bar
Created December 9, 2015 09:12
WordPress remove admin bar
// Remove Admin bar
function remove_admin_bar()
{
// return true;
if (!current_user_can('administrator') && !is_admin()) {
return false;
} else {
return true;
}
}
add_filter( 'wp_login_errors', 'wpse_161709', 10, 2 );
function wpse_161709( $errors, $redirect_to )
{
if( isset( $errors->errors['confirm'] ) ) {
// echo "<pre>";
// print_r($errors->errors);
// echo "</pre>";
// echo $errors->errors['confirm'][0];
$errors->errors['confirm'][0] = "Please wait for and email, you don't need to do anything right now.";
@celticwebdesign
celticwebdesign / gist:3080f1eb91a0842a439d
Created December 11, 2015 17:12
WordPress - change the login new password text (http://www.xxx.net/wp/wp-login.php?action=rp)
Add to functions.php
add_action( 'login_enqueue_scripts', 'enqueue_my_script' );
function enqueue_my_script( $page ) {
wp_enqueue_script( 'my-script', 'http://www.xxx.net/wp/wp-content/themes/xxx/js/myjs-file.js', null, null, true );
}
Add to new .js file in theme