Questions tagged [php]

For questions about the server-side programming language that the WordPress core, plugins and themes are written in. Questions about using PHP outside a WordPress context are off-topic but might be asked on Stack Overflow.

Filter by
Sorted by
Tagged with
0
votes
0answers
3 views

Set product shipping classe on-the-fly at checkout with functions.php

I need a unique product because I have many possible option combinaisons, then I need to be able to set the shipping class for the product at checkout. I can't find the right filter in the woocommerce ...
0
votes
0answers
3 views

Saving an array of dynamic repeater data as post_meta

Looking for some Wordpress specific PHP help. I'm making a time sheet with employees listed and in/out for everyday of the week. I am pulling an ACF repeater row of employees from another page that ...
1
vote
1answer
15 views

adding custom user input fields in WordPress admin dashboard gives error The link you followed has expired. Please try again

I am developing a wordpress theme for themeforest so its for commercial use and adding a custom input field of social media to the user menu in the WordPress dashboard gives error after i click Update ...
0
votes
0answers
10 views

Hide class if another class is empty [closed]

I want to hide the contract class if the person_name is empty. SO that read more doesn't appear in the director's image box. Please help. Here is the code. <?php $cnt=0;$opn=0; foreach ($rows as $...
0
votes
0answers
7 views

Order posts by hour with ACF and Timber (TWIG)

First of all I use ACF and Timber (TWIG). I'm trying to create a calendar with a classification by year, month and hour. I created a custom ACF field : event_date and an another field for start time ...
0
votes
0answers
7 views

Creating Conditional Fields in Elementor Custom Widget [closed]

How are conditional fields or field groups created in Elementor? I've not found anything in the documentation regarding conditional fields for widget development. A simple example of what I'd like to ...
0
votes
0answers
6 views

Woocommerce payment based on cart value & user-roles [closed]

I'm trying to filter payment method in woocommerce. My conditions are as follows. Only Verified Customer able to use COD Minimum $15 for COD Payment I tried this code: function filter_gateways($...
0
votes
1answer
22 views

Passing the name of selected color from the custom <ColorPalette/> component to `render_callback`

I have a custom block with the ColorPalette component. In this component, I have an array with several colors to choose from. The ColorPalette component only passes a color value. I would like to pass ...
0
votes
0answers
12 views

WOO // PAYPAL disable payment method results in Fatal error [closed]

i have an incompatibility with two plugins. there I need to disable the PayPal quick check out if a product from a special category is being bought. this works perfectly fine from a frontend ...
0
votes
0answers
23 views

How can I display videos in wordpress archive page [closed]

I have a custom field and using Astra theme, how can I hide featured image and display correctly that videos in archive? (archive.php) <?php /** * The template for displaying archive pages. * * @...
0
votes
0answers
12 views

How can we Include Multiple Product IDs in a PHP Action [closed]

How can we include multiple product id in the if ($product->get_id()=="15757"){ add_filter( 'woocommerce_quantity_input_args', 'ts_woocommerce_quantity_selected_number', 10, 2 ); ...
0
votes
0answers
18 views

How to make a pagination with dropdown selection?

This is the code for the dropdown pagination. It uses a js controller too, but it works fine, so, I’m not adding it. $total = $wp_query->max_num_pages; // only bother with the rest if we have more ...
1
vote
3answers
38 views

The custom logo, site title, and description doesn't appear at the same time

The problem I'm having is the custom logo, site title, and description won't appear at the same time. In image 1 below, you can see that with no custom logo, the site title, and description appears ...
0
votes
1answer
17 views

I am receiving a pluggable.php warning sign on my only http:// page

I just recently shared a link to my site using he http to my site: http://thechronicalist.com but instead of redirecting, i just displays this: Warning: Cannot modify header information - headers ...
0
votes
0answers
22 views

Blank featured image in media library only with variable url, but work nicely with static image url

I create plugin who create my posts from content files. My featured images are a list of urls. In CASE n ° 1, I test with a static url, the image is well imported and present in the media library (as ...
1
vote
1answer
25 views

using add_action for a header hook that has an additional parameter

The theme I'm using has a hook inside header.php file to separate the header into two parts, left & right. I want to add some content into the right section but I don't understand how can I add ...
1
vote
0answers
15 views

Get first two paragraphs inside one div, and then get the rest under another?

I have to define non-paywall and paywall text in the_content(); per google rules, so far I tried: $content = apply_filters('the_content', get_the_content()); $str = substr( $content, 0, ...
1
vote
1answer
19 views

code is working properly in Core PHP but writing coding in WordPress

function generate_pdf($array) { header('Content-Type: text/csv'); header('Content-Disposition: attachment; filename="sample.csv"'); $fp = fopen('php://output', 'wb'); foreach ( $array ...
0
votes
1answer
29 views

SOLUCIONAR ERROR 500 POR: printf(_x(' %s ago', '%s = human-readable time difference', 'benaa'), $human_time_diff); ?>

SOLICITO AYUDA PARA CORREGIR ERROR 500 EN MI WEB. EL ERROR SE ESTÁ PRODUCIENDO EN ESTAS 2 LINEAL SEGÚN ERROR LOG: [15-Oct-2020 16:39:13 UTC] PHP Warning: printf(): Too few arguments in /home2/...
2
votes
0answers
12 views

using woocommerce_template_single_add_to_cart in shop-loop - javascript issues [closed]

We want to show product variations on all product tiles, in all views. I have some code using woocommerce hooks added to functions.php (see below) that does the trick visually but we have several ...
0
votes
0answers
15 views

I want to fusion the product columns in email table order

I have an E-commerce apparel Website (for T-shirts and hoodies, etc...) with a design studio. The customer can order products in 2 ways… either a blank product without entering the designer studio by ...
0
votes
0answers
9 views

Merge 1 Multidimensional array into a single array [closed]

I need to merge a multidimensional array to create a new array. This is what I have Array ( [0] => Array ( [0] => 123 [1] => "Title #1" [2] => &...
0
votes
0answers
15 views

Hide payment method based on user role AND minimum cart value

Around April this year, we have to move our business 100% online due to the pandemic. Physical store hardly get one customer per day. after 5 months, we recognizes pattern; almost all failed COD ...
0
votes
0answers
15 views

PHP Parse error [closed]

I'm getting this error: "Parse error: syntax error, unexpected 'endwhile' (T_ENDWHILE) in /var/www/vhosts/website/httpdocs/wp-content/themes/website/blog-masonry-grid.php on line 209 There has ...
0
votes
1answer
11 views

POST request received is transformed to GET request [closed]

I have a WordPress website where I need to receive a POST request (a callback to be more specific). So I created a handler - conveniently called handler.php - to receive this POST request. While ...
0
votes
0answers
12 views

How to use Multi SQL Database in Wordpress?

It is my wp-config.php of Wordpress site. <?php /** * The base configuration for WordPress * * The wp-config.php creation script uses this file during the * installation. You don't have to use ...
0
votes
0answers
44 views

separate list of programs in html/javascript coming from php

I have a html/php code as shown below which displays list of links coming from wordpress. html/php: <header class="entry-header container grid-flex"> <div class="flex-item -...
-1
votes
0answers
6 views

change input attribute disable=“disable” value by jquery [closed]

i am working on a wordpress theme and i to validate some conditions i want the input disable attribute to be changed if my if condition will execute: here below is my input btn:- <input type="...
0
votes
0answers
17 views

wordpress email checker on domain

I need a email verification when a users/admin logs into wp-admin. So it checks if the domain is @gmail.com and when is not i have functions is this possible? I made it with id checker but is was not ...
0
votes
0answers
8 views

Is it possible to add get_search_form() into wp_nav_menu_objects or wp_setup_nav_menu_item filter?

I want to add Default search box get_search_form() in menu page by using wp_nav_menu_objects or wp_setup_nav_menu_item filter hook.
0
votes
0answers
13 views

Data erase confirm link address does not work

A link is sent to the user by Email to confirm the deletion of the data. The link looks like this: http://www.example.com/login/?action=confirmaction&request_id=13200&confirm_key=...
0
votes
1answer
37 views

Is there a PHP function that will return the block ID generated by WordPress?

I've tried the parse_blocks() function, however it returns all of the blocks. I'm needing to narrow it down to just the current block's ID. Is there a PHP function for that? I'm needing get the unique ...
0
votes
1answer
12 views

Custom plugin: how do I call a PHP file if settings option is set to true?

I am making a custom plugin with various functions that do different things. I have created a settings page using the Settings API to save data to the options db. That works fine. Now I'm trying to &...
0
votes
0answers
9 views

Regular expression to find quotes in the post content

I have been trying to get quotes from post content I have failed to find a perfect regular expression for it. How can I filter them out? For Example if get_post_content() returns this below <...
0
votes
0answers
11 views

Woocommerce hook run after an Order been created through REST API

I'm building a plugin that needs to update data after order creation! I have succeeded in doing that on the website but not in the REST API What I have done is using woocommerce_thankyou that working ...
1
vote
1answer
22 views

Change Navigation Bar based on logged in or not

I am using the BuddyBoss theme (BB child theme active) and need to control which menu appears based on whether the user is logged in or logged out. Logged out are granted access to a few URIs but most ...
0
votes
0answers
25 views

Wordpress Ajax Custom Query - High CPU LOAD

I'm developing a fully ajax community WP theme that comes with alot of custom quaries. Everything is fine, there is no bug but recently but I had a few client that have a huge database and my theme ...
0
votes
0answers
14 views

Send pdf file by API

I want understood process how can send local pdf file to server via using Ajax + PHP in wordpress. I have user form on modal window. When user click send button i must send all entered data with pdf ...
0
votes
0answers
6 views

retrieve “Link Color” value

I've set the Link color using the color picker in the front end. I want to use this color for buttons on the site so I used the following code in header.php <style> .btn{ background-color: &...
0
votes
1answer
19 views

PHP Warning: mysqli_query(): after updating my websites php from 5.6 to 7.2

Recently I updated my websites php from 5.6 to 7.2 but afterwards my website sometimes/often shows the internal server error message. I set debug to true and got the following errors: PHP Warning: ...
0
votes
0answers
14 views

Qtranslate-XT Term Name Translation

I want to get the term name in a specific language (English), instead of getting the term name of the current language. $term = get_term_by( 'id', absint($cityname), 'city'); $term_name = $term->...
0
votes
1answer
18 views

Critical error on your site

I own a site on wordpress but I don't know coding, from tomorrow I am unable to access my site. it is showing "critical error occurred " The problem showing is Fatal error: Uncaught ...
0
votes
0answers
16 views

Storing session variable without interfering with Varnish

I have a form (www.example.com/form) that submits to a 3rd party app to add users to a contact list. The vendor does not provide any means of using AJAX, rather they allow you to specify a URL to ...
0
votes
0answers
23 views

How do I separate media into displaying in specific categories on WordPress homepage?

I have a site that has some custom code that pulls items from the media folder and displays them on the home page. We now want to possibly display the images pulled into specific category. How would I ...
0
votes
1answer
22 views

How to remove the h6 tag for the entry-category Class

On my single blog pages at the very beginning, I have the html <h6 class="entry-category is-xsmall"> <a href="www.website.com" rel="category tag">category ...
0
votes
0answers
10 views

wp-admin on login returns white blank page , but it turns normal if i refresh

I am working on a wordpress website and i am little stuck into some situation, i added some hooks in function file like (redirect after login). Everything is working fine till now, i just get one ...
0
votes
0answers
14 views

How are certain words allowed in comments?

I want to improve Wordpress blacklist. Wordpress suspends the comment when it catches a word added to the blacklist. But this creates some problems. Because wordpress makes a match. For example, let's ...
0
votes
0answers
18 views

How do I select two meta_value by $ wpdb-> get_row mode?

How do I select two meta_value via $ wpdb-> get_row or a lighter way? global $wpdb; $id = get_the_ID(); $selecttwovalue = $wpdb->get_row("SELECT PM.meta_value, DU.meta_value FROM $wpdb->...
0
votes
0answers
22 views

Checkbox is not being set

isset not working. My goal is when the checkbox is checked I want to set a variable to a certain value but even when I check the checkbox the value of $mystring would be "no". Please let me ...
0
votes
1answer
20 views

How can I prevent a shortcode div from extending beyond its boundaries?

I have a shortcode for user-defined social media buttons that works well, except for the fact that the div extends beyond its boundaries, meaning that if this shortcode is called in a widget, the ...

1
2 3 4 5
183