New answers tagged

1

Solved it! Amazing what a good nights sleep does! Function: function get_all_rating_criteria_travel6(){ global $wpdb; $rating6 = $wpdb->get_var( 'SELECT RatingCriteriaText from ratingcriteria WHERE NicheID=1 AND StarRatingID=5;'); echo $rating6; } Code to display: <?php get_all_rating_criteria_travel6(); ?>


0

My quick and dirty solution was to nest 2 arrays and loop through them. You'll need to hard-code your nth level URLs. This example singles out a specific custom post type. function yoast_seo_breadcrumb_append_link( $links ) { global $post; if ((is_singular('team-members'))) { $breadcrumbs[] = array( array( ...


1

Have you tried this? E.g. the paypal button function name is woo_custom_paypal_button. Then add action like this into your function.php or specific plugin: add_action( 'woocommerce_checkout_before_customer_details', 'woo_custom_paypal_button' ); Or if there's something that's already displayed there, and you might want to remove it, first find the function ...


0

add_action( 'customize_register', 'theme_customize_register' ); /** * Register individual settings through customizer's API. * * @param WP_Customize_Manager $wp_customize Customizer reference. */ function theme_customize_register( $wp_customize ) { // You can first start by adding a section $wp_customize->add_section( '...


0

Below is the updated code to fetch posts, please check is that helpful: $documents = get_posts(array( 'post_type' => 'post', 'posts_per_page' => -1, 'meta_query' => array( array( 'key' => 'our_people_author', // ...


1

Change form.php <form action="<?= $_SERVER["REQUEST_URI"]; ?>" method="post"> <input type="hidden" name="form_submit_nonce" value="<?php echo wp_create_nonce('form-submit-nonce'); ?>"/> <label for="id">ID</label> <input id="id"...


0

Removing the Coupon Field Using Option If you are really fed up with the coupons, you can easily remove the coupon field altogether. To do that, go to the WooCommerce > Settings page, click on the ‘Checkout’ tab. Uncheck the ‘Enable the use of coupons’ and click ‘Save Changes’ button. At this point, you no longer have the coupon field anywhere in your ...


0

Add this Code in your function.php file function mito_login_message( $message ) { if ( empty($message) ){ return "<p><a href=''>hyperlink</a> Please login to continue</strong></p>"; } else { return $message; } } add_filter( 'login_message', 'mito_login_message' );


0

The following code should return you the correct category names, however I am not clear what you're actually trying to achieve. I think you're using the foreach loop in wrong way. Are you trying to add all the category names as css classes for the div or something else? <div class="row masonary-wrap"> <?php $args = array( 'post_type'...


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 ...


1

Sometimes you want to delete not the html code but shortcode. Then use something like that: add_action( 'pre_amp_render_post', 'amp_vid_rmv' ); function amp_vid_rmv() { add_filter( 'the_content', 'amp_vid_div_rmv' ); } function amp_vid_div_rmv($content) { $content = preg_replace('#\[shortcode_name_here\]<br \/>#', '$1', $content); ?> <...


1

If you just want to get the selected color name, then you can use the getColorObjectByColorValue() function in the @wordpress/block-editor package, which is wp.blockEditor.getColorObjectByColorValue in the browser. The function accepts two parameters: a color list (each is an object with color and name as the properties), and the color (a HEX code, e.g. #...


0

Thank you Tony. This is the css code I have. May be this will help. I tried to ad it to my comment yesterday, but it wouldn't let me. #hotwp-logo{ margin:5px 0px 5px 0px; float:left; width:41%; } .hotwp-logo-img-link{ display:block; } .hotwp-logo-img{ display:block; padding:0; margin:0; } .hotwp-site-title{ font:normal bold 24px 'Playfair Display',Arial,...


0

printf() combines a format string and a number of other inputs into a single string to output. The format string contains placeholders, usually %s or %d but there are others, to be substituted for values that you also pass as arguments. For example php > printf('Me llamo %s', 'Rupert'); Me llamo Rupert Here there is one %s in the format string so I gave ...


1

Ricky, you'll have to write the proper CSS to get it to display exactly as you want it to, but the problem you're having is that you're ONLY requesting the custom logo IF the custom logo exists. IF it doesn't exist, you're asking for the title and the description, but ONLY if there is no logo. Try this instead: <div id="hotwp-logo"> <?php ...


1

Maybe I'm missing something here, but it looks like you have an if-else. If there is a logo, it shows. Else the title and description show. Try removing the if-else stuff.


1

The headers already sent message means that something -- a plugin or a theme, usually -- is sending output before it's meant to. Often this is due to whitespace appearing in a file after the closing ?> tag, which can make it hard to find the culprit. The fact that pluggable.php is mentioned tells me that it's most likely a plugin that's replacing some of ...


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 ...


0

When I attempted something similar I experienced the same issue where the HTML code of the page I was generating the CSV from would be included within the CSV mixed with the data I actually wanted. The two things I figured out, after searching and reading and reading and searching was to use ob_end_clean(); before I start outputting the content of the CSV. ...


0

As you mentioned in the comments, if what works best for you is displaying different header files based on whether a user is logged in or not, this is the best way to achieve it: if( is_user_logged_in() ) : /** This is the name of your second header file. * It assumes the 'header-' and the '.php' portions. * So the following get_header would ...


0

Use a multilingual plugin like Polylang


0

You can iterate on your parsed blocks to get the right block. $blocks = parse_blocks( $post->post_content ); foreach ( $blocks as $key => $block ) { if ( 'block_xxxxx' === $block[ 'id' ] ) { // do some action here } }


0

Nevermind, I figured it out. Here's what I did in case anybody else wants to know. In my main php file in the plugin directory, I just added the following: if (get_option('new_option_name') == 'true') { require_once plugin_dir_path(__FILE__) . 'includes/theme/functions/add_id_user_admin.php'; }


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

Your PHP ‘timeout’ setting is too low. If a PHP script needs access to your database and it can’t fetch the information within the timeout window that’s been set, this can also trigger


1

You don't need functions for this, just look in your theme's template files: For single posts check single.php and for blog archive/categories check archive.php. Change the <h6> in those php files to <div> or whatever you want. It would be wiser to override them with a child theme so you don't lose your changes in a future update of the theme.


0

I'd look at the wp-settings file to see if there is something added there that shouldn't be there. Look at a backup copy of it, or the default one in the WP core code. You could also reinstall WP manually. Many googles/bings/ducks on how to do that; here's one: https://www.wpbeginner.com/wp-tutorials/how-to-uninstall-and-reinstall-wordpress/ . Make a backup ...


0

Resolved using this: <div> <ul> <?php $current_category = get_queried_object(); ////getting current category $args = array( 'post_type' => 'page',// your post type, 'orderby' => 'menu_order', 'order' => 'DESC', 'cat' => $current_category->cat_ID // ...


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 ...


1

How the JS script works On page load, the script loads the post comments by making an AJAX request to a custom WordPress REST API endpoint at /tcm/v1/comments/<post ID> (here's a sample URL, valid as of writing). Then the script displays the comments sorted by the sort_field value in the comment localization parameters defined in the ...


0

Some debugging steps that might help So this may not exactly answer the question, but your code is good and you also said it worked (perfectly) fine on the staging site, so this is likely a plugin issue or a custom code in the active theme, whereby the plugin/code is overriding your posts_per_page setting via the pre_get_posts hook or a similar one (for ...


2

You have two tasks to solve here: 1. Resolve the time-out problem. 2. Update WordPress. Resolve the time-out problem These things don't just happen because your WP is old. There must be a concrete reason. The three most common reasons are: Not enough memory. Maybe your hosting provider has limited the memory? Try adding the following line in your wp-config....


1

The problem is the hosting not wordpress EDIT: Just send the capture and link of your website to the hosting company and tell them to correctly update the PHP version and install the necessary libraries on the server to run wordpress


Top 50 recent answers are included