Skip to content

Instantly share code, notes, and snippets.

View chered's full-sized avatar

chered chered

View GitHub Profile
::-webkit-input-placeholder { /* WebKit, Blink, Edge */
color:#909 !important;
}
:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
color:#909 !important;
opacity:1 !important;
}
::-moz-placeholder { /* Mozilla Firefox 19+ */
color:#909 !important;
opacity:1 !important;
//seach template for coach cpt
function template_chooser($template) {
global $wp_query; $post_type = get_query_var('post_type');
if( $wp_query->is_search && $post_type == 'coach' ) {
return locate_template('page_coach.php');
} return $template;
} add_filter('template_include', 'template_chooser');
//create shortcode for a coach archive row
function myt_create_shortcode_coach_post_type(){
$args = array(
'post_type' => coach,
'posts_per_page' => 6,
'post_status' => publish
);
$query = new WP_Query($args);
function my_pmprorh_init() {
// Don't break if Register Helper is not loaded.
if ( ! function_exists( 'pmprorh_add_registration_field' ) ) {
return false;
}
// Define the fields.
$fields = array();
$fields[] = new PMProRH_Field(
'first_name', // input name, will also be used as meta key
(function($) {
// store the image link inside a variable from 'src' attribute
var getImageSrc = $('.banner-front-left .fl-post-grid-image img').attr('src');
// add div background image using the variable above
$('.banner-front-left .fl-post-grid-image').css('background-image', 'url(' + getImageSrc + ')');
// store the image link inside a variable from 'src' attribute
var getImageSrc = $('.banner-top-right .fl-post-grid-image img').attr('src');
@chered
chered / gist:0146a7d3fb8323e4e7de8d706aa95900
Created July 29, 2020 05:27
wordpress - first and last name author display plus date
<div class="r-author"><?php the_author_meta( 'user_firstname', $userID ); ?>&nbsp;<?php the_author_meta( 'user_lastname', $userID ); ?>&nbsp;-&nbsp;<?php the_date(); ?> </div>
$role = get_role( 'author' );
$role->remove_cap( 'upload_files' );
add_action("load-post-new.php", 'block_post');
function block_post()
{
if($_GET["post_type"] == "physician" || "posts" )
wp_redirect("edit.php?post_type=physician");
}
function searchfilter($query) {
if ($query->is_search && !is_admin() ) {
$query->set('post_type',array('post','page'));
}
return $query;
}
add_filter('pre_get_posts','searchfilter');
<?php
global $wp_query;
$total_results = $wp_query->found_posts;
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
?>
Found <?php echo $total_results ;?> Results
Page <?php echo $paged; ?> of <?php echo $wp_query->max_num_pages; ?><br />