New answers tagged

0

Sometimes a default (if that exists) WordPress css attribute name may have a conflict with the attribute names in your css . Try changing your css names to something different of more descriptive, An example name that I've seen bring conflict/WSOD aka: "White Screen Of Death" in WordPress is .page Try avoiding words like: blog wordpress wp header ...


0

These above solutions are great but for an incredibly simple fix for this specific issue. I've added the CSS for img-fluid onto the standard classes that wordpress adds to it's images: .size-thumbnail, .size-medium, .size-large, .size-full { max-width: 100%; height: auto; } This may not be as elegant as the above solutions but performance wise it's ...


1

Follow up on @jmarceli's and @squarecandy's great answers. Here is a solution that allows for: Easier scaling (set an object in the php action) Updates to the correct menu depth when the location checkboxes are changed /** * Limit max menu depth in admin panel */ function limit_admin_menu_depth($hook) { if ($hook != 'nav-menus.php') return; ...


0

I am customizing the same theme. In my child theme functions file, I did the following to override the height: /* * Customize the header image parameters * See parent theme /inc/custom-header.php for reference */ function custom_parameters_wp_bootstrap_starter_custom_header_setup() { add_theme_support( 'custom-header', apply_filters( '...


0

That error messages means a failed admin nonce validation (check_admin_referer, which calls wp_nonce_ays). And you don't actually need an extra nonce here: these are extra fields to be added to existing forms that already have their own nonces, and the one you've added just clashes with them. (If you were adding a new form you would need these, yes.) So I ...


0

add_action('customize_register', 'theme_footer_customizer'); function theme_footer_customizer($wp_customize){ // Get upload directory $upload_dir = wp_get_upload_dir(); // Create style file path $style_file_path = sprintf( '%1$s/css', untrailingslashit( $upload_dir['basedir'] ) ); // Create directories if they do not exist if( ! ...


1

You could set the 'depth' argument to 1 in your wp_nav_menu() call to get only top level items, along with the custom menu walker, something like this: return wp_nav_menu( array( 'menu' => $name, 'menu_class' => 'footer-menu', 'echo' => false, 'depth' => 1, 'walker' => new custom_footer_menu_walker ) ); Add the custom menu walker to your ...


2

How can I pass 'right' parameter into add_action? In short: You don't pass 'left' or 'right' itself to add_action(), but you can make the parameter be available in your callback by using the fourth parameter for add_action(). See examples below. So despite you may already know this, a hook is a specific place in a block of (PHP) code where custom functions ...


2

The get_the_author can directly be used to display the name of the author. There are few settings to be done on the admin for this: Under the user settings add make sure you have the first and last name fields filled up. After that see for the Display name publicly as options and select whichever format you want the name to be shown. Click save and refresh ...


0

Ended up creating a plugin for this: https://davidstockdalescrapcode.co.uk/my-plugins


2

I've made a page where the user can check the supported post formats, and the problem was that in case the user haven't checked any post format it returns false, and instead of returning an array that contains 'standard' like the following return ['standard'], I used only the keyword return to stop the function from running. Here is what I am talking about: ...


0

I was missing the condition for the array inside the tax_query array. It is important to have it regardless if you have one or more conditions. $term_search = get_queried_object()->slug; // WP_Query arguments $args = array( 'p' => 'product', 'post_type' ...


1

If you are using bootstrap and want a responsive image in the_content(). You may try this code; works fine in my case img-fluid. You can replace it with your own class. function add_image_responsive_class($content) { global $post; $pattern ="/<img(.*?)class=\"(.*?)\"(.*?)>/i"; $replacement = '<img$1class="$2 ...


0

The problem is here: while ( $query->have_posts() ) { $query->the_post(); function filter_categories($categories) { foreach ($categories as $category) { echo $category->name; } } You ...


0

$galleries = $wpdb->get_results("SELECT meta_value FROM $wpdb->postmeta WHERE (meta_key = '_product_image_gallery' AND post_id = '". $post_id ."')"); $gal_images_ids = $galleries[0]->meta_value; foreach (explode(",", $gal_images_ids) as $gal_img_id) { $gal_images_url = ...


0

You'll want to use the % math operator. if ( $currentPost % 5 === 0 ){ echo "Ad Space</br>"; }


0

because I'm not echoing anything in this code. But you are! This code: function smb_function( $atts ) { ?> <div class="social_button_shortcode"><?php Is the same as: function smb_function( $atts ) { echo ' <div class="social_button_shortcode">'; Likewise with the closing div tag at the end. Any form of direct ...


0

I resolved the case. Problem here was on &fields variable declaration and also to 'comment_field' assignment. I had to change name fields with the correct ones. Check code below: function dck_custom_comment_form() { //Declare Vars $comment_author = 'Name *'; $comment_email = 'Email *'; $comment_body = 'Comment *'; $comment_cookies_1 = ' By ...


2

replace the first line on this include(get_template_directory() . '/inc/email_templates/quote.php'); when accessing a file, use the absolute path, not the uri


Top 50 recent answers are included