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

How to update wp-config file in Docker

I am trying to change our blogs from Wordpress to inside a docker container, so that we can move around it easily. I wrote a docker-compose file for the purpose and it ran smoothly the first time. But ...
0
votes
0answers
4 views

I need help with removing the a href file from all of the item on the content-product.php

I am needing to remove the product link as pictured below from the I'm not sure how to do it. can some one please help me, any method such as PHP, html or other can be used. Thanks again Kind Regards
0
votes
0answers
4 views

How to disable e-mail notification new comments for some categories

How to disable e-mail notification new comments for some categories Sorry for my English
0
votes
0answers
10 views

Source link plugin - show just anchor / link

I implemented a small source link plugin on my Wordpress website via the following codes. Single.php: <?php global $post, $pages, $page; $total = count( $pages ); // Link ...
0
votes
1answer
14 views

I want to remove the register/login Wordpress top bar from my website

enter image description here]1, This screenshot above shows the functions.php code snippet I tried to use to remove Wordpress register/login top bar from my website but so far it haven’t worked. I ...
0
votes
0answers
6 views

Change billing fullname with a custom field in Woocommerce emails

I using Checkout Field Editor for WooCommerce to make 25 custom field. I have problem billing_fullname not show in customer details but show in billing address. So i have thinking about a solution ...
0
votes
0answers
10 views

Unable to update wordpress due to database error unknown column

I get this error in my wordpress error log [05-Mar-2021 04:10:10 UTC]WordPress database error Unknown column 'tickbox_auto' in 'where clause' for query SELECT * FROM wpdx_payment_discount WHERE status ...
0
votes
0answers
15 views

Add width and height attribute to an img tag

I am using Hood Theme and I have a logo on the top left on my navigation. I have set this logo to 150x50 which works fine. But the tag doesn't have the width and height attribute. Google PageSpeed ...
0
votes
0answers
6 views

Missing post when i switch language from default english to japan

I am using the Polylang plugin. The default language is english and it displays the news section, but when I switch to JP (japanese) the news section is missing. $news = new WP_Query('category_name=...
0
votes
0answers
20 views

PHP variable = get_the_post_thumbnail_url outputting without slashes

In a custom shortcode function, I'm grabbing the featured image URL: $text_slider_testimonial_img = get_the_post_thumbnail_url($single->ID); If I echo $text_slider_testimonial_img immediately I ...
0
votes
2answers
20 views

Parse error: syntax error, unexpected '}' surrounding a while

I'm just having trouble figuring out why I'm getting an error at the "}" after the "$attachment_image" line, just before "". I'm probably just too tired to see it. <?...
0
votes
0answers
7 views

How to create post comparison in wordpress

I am creating a feature in the child theme which is vehicles(car) comparison. the checkbox will add the vehicles(car) in the compare list from the car listing page. and compare page will give the ...
0
votes
0answers
25 views

Error when adding excerpt to the content through functions.php

I am trying to add the excerpt from a specific post to the content. function add_2_the_content( $content ) { if (is_front_page()){ $custom_content = get_the_excerpt('some_id_number'); } $...
-1
votes
0answers
12 views

I need to know how to add a php code into our company's website [closed]

I have a data receiving from HART Devices and need to store that data in php file. I need to store that HART data in our company's website. Whenever I type our company's website as given below, I need ...
0
votes
0answers
8 views

show category list with images of associated posts

any way to display a list of categories with a single image of any post associated with that category? i have this code: $categories = get_categories( array( 'orderby' => 'name', ...
0
votes
0answers
14 views

How to Generate Random index page/content like the website “What The Fuck Should I Make For Dinner?” [closed]

I want to create a website similar to "What The Fuck Should I Make For Dinner?" I don't want to just have a button that takes the user to a random page changing the permalink each time. The ...
0
votes
0answers
13 views

Mobile detect directive only works after first refresh [closed]

I am trying to detect mobile devices and send them to a different directory on my server. The desktop version of the website is a WordPress website; the mobile version is HTML. At the moment, the ...
0
votes
0answers
8 views

WC Update (just save) all Products at once (php?)

i need to save every single product again. but all at once since i have 1000 products. reason being is that im using the WC api to import WPML Translations and they need to be saved since WPML doesnt ...
0
votes
2answers
28 views

Display values of current POST request on page

I would like to get some value that was included in the http request header and display it on my webpage, i.e: I have a webpage, say: 'mywebsite.com' I have a POST request to 'mywebsite.com' with a ...
0
votes
0answers
24 views

Unwanted code being automatically added to the functions.php and makes the site very slow [closed]

I have a website that is built by WordPress and it uses the Avada theme. It's a long time there has been a bizarre problem which occurs every few days. When it occurs the site pages can't be loaded or ...
1
vote
0answers
14 views

Automatically adding new post categories to menu

Disclaimer: I am not 100% fluent in php. If I am doing something wrong in asking this here, please let me know. Many thanks! A site that I am working on is set up with several custom post types: City, ...
0
votes
0answers
85 views
+100

PDF file randomly breaks upon upload

The issue randomly started happening. When I upload a PDF file via the media library, it sometimes 'adds' random lines and graphics to the PDF file(or solid brown color), but sometimes it is okay. WP ...
0
votes
0answers
15 views

Show Content of shortcode out of div and site structure

With this function, I generate a series of shortcodes, some of which are variable. The problem is that when this shortcode is placed inside the site, the content of the shortcode is displayed, but the ...
0
votes
1answer
58 views

how to echo a background image in a custom post type

I've setup a loop for custom post type // The Query $the_query = new WP_Query( 'post_type=support_medewerkers&posts_per_page=1' ); // The Loop if ( $the_query->have_posts() ) { while ( $...
0
votes
0answers
17 views

Real time post display on home page (as soon as they are published)

I have noticed this becoming a trend with comments and now posts. I'm sure many sites (especially community ones) will implement this. Here's exactly what I mean, click here: https://stackexchange.com/...
0
votes
2answers
27 views

How to block specific user id in custom login form?

I've been looking for this method for weeks, but still can't find it. There are so many sites that discuss how to create a custom login page, but they don't cover how to block a specific id like the ...
0
votes
0answers
9 views

index page shows loop of all posts, I want to change it into loop of 'exhibitions' category

Index page shows loop of all posts, I want to change it into loop of 'exhibitions' category my website is on my localhost but I am using this wp theme http://expositio.wpshower.com i don't know php ...
0
votes
1answer
17 views

Add meta tags to a custom header

I'm trying to create php code to change the Wordpress header. With the help of https://wordpress.stackexchange.com/a/134524, I have the following: add_filter( 'wp_headers', 'add_meta_to_header' ); ...
0
votes
0answers
30 views

call to undefined function mysql_connect

Trying to run a search and replace but am getting an error Call to undefined function mysql_connect() in E:\xampp\htdocs\test\wp-includes\wp-db.php:1688 I have checked my WP files and have both ...
0
votes
0answers
16 views

How to call function to href from another file

How to to href from another file I want to call function to modal-buy-coin.php from backend.php modal-buy-coin.php <a href=" <?php echo shortlinks() ?>" class="button ...
0
votes
2answers
16 views

Show a specific post in wordpress with links

I have a WordPress project im doing, pretty much I need to add 4 individual blog posts with background images behind the specific posts. This is the code i found and used, the only issue is they blog ...
0
votes
1answer
25 views

Multiple meta_key in one global $wpdb;

I have this code which works great: global $wpdb; $ticker_tag = $wpdb->get_col( "SELECT meta_value, COUNT(*) AS c FROM $wpdb->postmeta WHERE meta_key = 'ticker' GROUP BY meta_value ...
0
votes
0answers
10 views

Order custom field values by popularity

I have two custom fields: "usp-custom-ticker" and "ticker". I want to combine them into one list (which I already successfully did with the following code): <?php $...
0
votes
1answer
53 views

Can't pass var from php wp_ajax into ajax script : result undefined or null

I can't understand why I get always a null or undefined response while trying to pass an php error from registration form into ajax script. I work in a custom plugin to add login, registration and ...
0
votes
0answers
25 views

Search by date in WordPress

The default Wordpress search works only for titles. I want for it to search by date. My default date format: 2012/02/24 I have managed to add a code to functions.php for 'custom field' search: ...
0
votes
1answer
17 views

Run a sql (update) after 12 hours after the user login. Woocommerce users

How can I Run a sql (update) after 12 hours after the user login (for Woocommerce users) After 12 hours after a user login, I want to run a sql/ function to update a value in the database. To set a ...
0
votes
0answers
26 views

How to select selected Html Drop Down and paste it automatically into a Contact Form [closed]

first of all its my first question in Stackoverflow, because im hardstuck in a problem right now. So hopefully someone can help me with that. The project: I am building a Product Configurator for a ...
0
votes
1answer
11 views

I have a button in homepage theme in 2 language

how I can send the user when he click in button learn more when he is in the English home page to about us in English and when he is in the Arabic home page and click go to about us in Arabic language
-1
votes
0answers
27 views

How to call sql guery to update a value in DB every day

I want to call this sql update_user_meta( $user_id, 'alg_wc_ev_is_activated', '0' ); every 12 or 24 hours. It doesnt't work with Custom WordPress Cron Intervals. Because: WP Scheduling runs in the ...
0
votes
1answer
17 views

How can I add multiple if in elseif condititon?

How can I add one additional condition for is_tax='listing_amenity'? This is the code: if (is_category()) { single_cat_title(); } elseif(is_tag()) { ...
1
vote
0answers
22 views

dividing sub-categories by parent category - WordPress

I am aware this question is very similar to previous questions however none of the provided answers seem to work for me. but my question is, how do I divide sub-categories by parent category? For ...
0
votes
0answers
22 views

Wp_Schedule_Event every few minutes doesn't work

I wrote the folowing timer in my function.php file. It should be called every certain time (3 minutes) but it doesn't work at all. function myprefix_custom_cron_schedule( $schedules ) { $schedules['...
0
votes
1answer
13 views

Dropdown Category form. Only show Sub-Categories

I'm trying to get a category dropdown working. I have a Custom Post Type called "podcast" and custom taxonomy called "podcast_category". What i want to display, is a list of ...
0
votes
0answers
18 views

Warning: The navigation role is unnecessary for element nav

I was trying to validate my blog with W3C, there some warnings was able to fix but not the one below. <nav id="site-navigation" class="main-navigation clearfix" role="...
0
votes
1answer
17 views

Get current user id in function php

I know that this question is already often asked but there is no exact answer for it. I need to get the loggedin user id to change a value in the database for this user. I tried 2 ways it didn't work. ...
0
votes
2answers
17 views

Custom PHP form needs refresh to load page correctly

I have a single page site with all content on it. The only other page I have is a "thanks for submitting the contact form" page. In this "thankssubmit.php" page I have my PHP form ...
0
votes
0answers
21 views

Proper way to remove html code on child theme

I'd Like to know what is the proper way on removing this little piece of code on a child wordpres theme <?php if( houzez_option('spl_con_tennant') != "" ) { ?> &...
0
votes
0answers
14 views

Populate Wordpress Menu with child categories and pages [closed]

hope you can help me with this. I've spent all day searching for an answer with no luck. First of all, i may not be searching for the precise terms so my apologies if something like this has been ...
0
votes
0answers
16 views

Child-Theme Category View with modified permalinks (%category% removed)

I created a new WP Website and added a child-theme to it. The child-theme contains header.php, footer.php and I also created a category.php, in which I show different headers for each category. I ...
2
votes
1answer
24 views

Question about the template-loader.php file

I am studying the WP code and have a doubt regarding the end of the /wp-includes/template-loader.php file, which handles the template that must be loaded for a certain URL request. if($template = ...

1
2 3 4 5
190