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
1
vote
0answers
29 views

Connect Wordpress with SharePoint [closed]

I'm new here and I'm also new to WordPress. I'm currently trying to connect my WP site to SharePoint and I'm stuck. My approach to solve this was to search for php libraries that would help me with ...
0
votes
0answers
9 views

why my function of woocommerce wordpress only pick first row from customize database table

I have a selection of cities and the price will change according to city selection. I have a customized selection of cities which is coming from the table from the database in front-page-features.php &...
0
votes
0answers
14 views

How to show linkedin from user info wordpress?

i need your help guys i want to show this linkedin information from my user management. But i dont know how to show it cause i dont know why this form is there, i mean so many form url profile there. ...
0
votes
0answers
27 views

How to display single product on shop page in WooCommerce

I want to display single product page on shop page using specific product id. I need all HTML design of single product page setup by current active Theme. I want to display single product into pop-up ...
1
vote
0answers
9 views

How to enable specific plugin only based around shop manager role?

I have created a nice clutter free dashboard for the shop manager role which gives permissions to edit, maintain the store and hidden unnecessary junk i.e widgets, updates etc The problem: The current ...
0
votes
1answer
52 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
12 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
1answer
22 views

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

]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 included the code into a ...
0
votes
0answers
19 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
14 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
17 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
7 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
2answers
104 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
25 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
8 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
28 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'); } $...
0
votes
0answers
9 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
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 ...
1
vote
0answers
15 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, ...
1
vote
0answers
111 views

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
18 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
0answers
61 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
18 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
42 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
19 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
69 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
2answers
17 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
26 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
11 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
59 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
29 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
18 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
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
vote
0answers
28 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
15 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
1answer
19 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
20 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
22 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
18 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
33 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 = ...
0
votes
0answers
16 views

Automatically add Link Images to Posts in WordPress if has not linked before or has specified class

I use this code to Automatically add Link Images to Posts in WordPress. function wpguy_linked_image($content){ if (is_single() === TRUE){ $searchfor = '/(<img[^>]*\/>)/'; ...
0
votes
1answer
14 views

Nested “do” and “add” Actions is possible?

I'm wondering Questions were asked about more than one "add_action" and filter nested before and it was deemed possible. Are nested cross actions added? Eg. add_action('init', function(){ ...
0
votes
1answer
42 views

How to pass parameters in wordpress shortcode?

Everything is working fine and it's displaying the comments of the current page with this shortcode [wpdiscuz_comments] using the code below. function my_wpdiscuz_shortcode() { $html = ""; ...
0
votes
0answers
18 views

Custom function to redirect to page if condition met (too many limited products in cart)

I've made a custom plugin. I am trying to limit the number of products a customer can buy from a specific category. Most of it works, but I cannot get it to fire the redirect function once the ...
1
vote
1answer
16 views

Return encoded Page Title outside of a loop

This is for a sidebar "Email this page" button (so outside of a loop) It will appear on Pages, products and archive pages. I've got the URL returning ok but can't get the page title to ...
0
votes
1answer
125 views

Filter posts with ajax form and checkboxes

I have a loop for my Custom Posts Type workshop filtered with two custom taxonomies group and teacher on the same page. The Ajax filter works perfectly. Each links of the filter works with a <input ...
0
votes
2answers
42 views

Ajax filter button display all posts

I created a loop for my Custom Posts Type workshop with two custom taxonomies group and teacher on the same page. The Ajax filter works perfectly thanks to the solution provided here. The user can ...
0
votes
0answers
27 views

What are the advantages/disadvantages of ways to use php template files?

I saw people using php files template parts that are basically php files with no (or very little) logic, that only insert/echo the dynamic content in the respective places. Maybe using the ternary ...

1
3 4
5
6 7
192