Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [php]

The server-side programming language that the WordPress core, plugins and themes are written in.

0
votes
0answers
6 views

How can I display all posts from child categories in the parent category?

I am trying to modify an existing website so that a parent category page displays the posts associated with both the parent and child categories. Currently, if there are any child categories, the ...
1
vote
1answer
28 views

How do I get current page ID in Wordpress customizer file?

I'm trying to hide or show customizer settings based on what page I am viewing similar to active_callback' => 'is_front_page', however, I haven't found a way how to access the current page ID from ...
0
votes
2answers
49 views

Unset session variable on page reload / setup but exclude AJAX

I'm currently trying to unset a session variable in WordPress if the page get's reloaded. I've tried a lot but it's not working like I want it. This is my function: /** * Unset filter session if ...
0
votes
0answers
10 views

Wordpress - Complex Forms

We have a very complex form on our website which is being generated using Formidable Forms (Pro version). It has a lot of conditional logic being used, and is very heavy in scripting as well as ...
0
votes
1answer
30 views

WP_Query To Display Product Of Brand On Taxonomy Page

I am trying to print all products of a brand on a taxonomy page. I find the wp_querry but i cant print the current brand name of the brand to show all products in this page. What to put on terms ...
0
votes
1answer
26 views

Register non hierarchical taxonomy and the show meta box in the post type

I am trying to show a meta box in my product post type, but I'm getting this warning error... Warning error... Warning: call_user_func() expects parameter 1 to be a valid callback, no array or ...
0
votes
0answers
17 views

Mysqli connect not working with PORT parameter

I have a problem with mysqli connection. When I do it this way: $link = mysqli_connect("localhost:3306", "admin_xxx", "password", "admin_xxx"); It's not working and gives error: Error: Unable to ...
1
vote
1answer
19 views

Integrating PHP into Javascript to display map markers with Google API - problem with wp_localize

I would display Google maps markers on custom site temple with Google API maps. I do everything like this post: Integrating PHP into Javascript to display map markers with Google API But a console ...
0
votes
1answer
25 views

Why File_exists returns true with or without ABSPATH?

I've been confused due to the result being true in both cases, with or without using ABSPATH constant for this: if (file_exists(ABSPATH . 'wp-config.php')){ echo "true"; } or if (file_exists('...
0
votes
1answer
20 views

Post source link plugin - small modification

I'm using a little plugin that allows me to add source link to every article. I found the code in this thread: Article source link for posts It's almost perfect, but I need to make 2 little ...
0
votes
0answers
21 views

WooCommerce filter shop page without any plugin via AJAX

I've build a fancy dropdown filter at the top of the WooCommerce shop products list: The list gets filled from a custom product meta called hardness. It can has 3 values: big, middle and small. The ...
0
votes
0answers
34 views

enqueue script adds another .css with same name?

First I apologize if I'm not clear but I'll try to explain my problem with my enqueue script. I am trying to build a WP theme (conveting HTML & CSS Website) with existing files, but when I try to ...
0
votes
1answer
18 views

Update an additional user meta field with a string

I have created a WordPress website. In the user section I have created an additional attribute called "Token" meta field. Every time a new user is created or a user logs in and is validated, I would ...
0
votes
1answer
21 views

How WordPress core manage the plugin installation

I'm learning about wordpress plugin creation. I've found very useful the documentations found on wordpress codex about this argument, but I've a question: How the wordpress core manage the plugin ...
0
votes
0answers
10 views

regarding the multilang. capabilities of wordpress: how to use them?

hello dear Wordpress and experts, just a question regarding the multilang. capabilities of wordpress: how to use them ? just planning a new Webseite with different languages WordPress offers ...
-1
votes
1answer
17 views

Getting custom field data from cart page to checkout page in woocomerce [closed]

Added some text fields to add for whom we are sending the gift by adding their name and personal message as well.For Personal message it is working fine If i add To field and click on proceed to ...
0
votes
1answer
8 views

Show the section only if custom taxonomy was chosen

So I have a code where all items of my custom taxonomy ('colour') are displayed. I broke my head trying to show the section ("colour__chart") only if one of taxonomy items was chosen. In simple words, ...
1
vote
1answer
33 views

Update PHP version 5.3 to 7.2 or first WP 4.7.11 to 4.9.8?

I am not sure if I am better of by upgrading WP to 4.9.8 when my PHP version is still on 5.3 or do the other way?
0
votes
0answers
26 views

Assign variable of Wordpress plugin to value of a javascript variable

I know there should be a way to achieve this but, unfortunately, I’m a newbie to PHP and I really need your kind assistance here. I spend hours to find a solution, have no hair left to pull out of my ...
-1
votes
1answer
22 views

Adding placeholder text field to woocommerce checkout [closed]

I am trying to add placeholder text to checkout page but it is not displaying any placeholder text on the first name and last name.It is displaying a new text field with the palceholder text which i ...
0
votes
2answers
32 views

admin-ajax GET response bad request

I don't like to use wordpress, but I'm working on a business client website that want to use it but without the default wp- prefix for files and folders.To find a solution and to try satisfate this ...
0
votes
0answers
10 views

Create drop down menu with the child categories of a category

I'm trying to create a drop down that has the child categories of a specific category as options. This is my PHP: $args = array('child_of' => 88); $categories = get_categories( $args ); foreach($...
0
votes
0answers
12 views

in the post admin, is it possible to make the post title input disabled using php?

I am customising my product post type and auto generating the post title using add_action('acf/save_post'). See my php below for this... class Product { /** * product constructor method. ...
0
votes
0answers
24 views

Get Post Primary Category

I have troubles with getting the posts primary set category. How should I achieve this? My code: global $post; $terms = get_the_terms( $post->ID, 'event-categories'); if($terms) { foreach( $...
0
votes
0answers
10 views

Woocommerce Add custom “Add to cart button” in single page with tags

I want to add a custom "ADD TO CART" button in the single product page. I have done it using the id of the product. <?php echo '<a href="?add-to-cart='.get_the_id($product_id).'">ADD TO ...
0
votes
2answers
29 views

Setting a cookie upon specific URL visit

I'm trying to set up, when a specific page/url is visited that a cookie is set and saved. So far I've tried this: add_action('init', 'set_cookie', 1); function set_cookie(){ if ( $currentURL == '...
0
votes
2answers
29 views

News post with multiple permalinks? When opened from different page

I’ve got a question. Maybe it’s something existing and I don’t know the name. Or maybe it’s something custom. I’ve got a post type for news. The news posts have categories. These are some examples of ...
-1
votes
2answers
25 views

How to distinguish if a plugin is not installed or just not active

I try to apply a check figuring out if a plugin is either not active or just not installed at all in the plugin directory. When I test I check for a plugin installed but not activated as seen in the ...
0
votes
0answers
29 views

wpallimport : Rename images

I have a datasheet in excel format. I'm using wpallimport plugin to import data into my blog. Basically my question is that how can I rename images when plugin upload them to my server when data is in ...
0
votes
0answers
21 views

How do I send a POST request with params with WordPress REST API

I am new to WordPress and I'm trying to make a POST request to login a user. I want to be able to send "username" and "password" as params while making this call. How can I do so. This my code so far ...
0
votes
0answers
10 views

How to query SQL for coords nearest a point? [migrated]

This is what i am trying to do: From a form I GET the coordinates: &usp-custom-20=45.492384716155605&usp-custom-19=9.206341950000024 The I query SQl to find all posts near those coordinates,...
0
votes
1answer
20 views

Getting the title of the parent page and displaying it only for certain parent pages

I'd need to fetch the title of a parent page on a page that shows a catalog of several pages, like this: I know how to do displaying the parent page: <p><strong><?php echo ...
0
votes
1answer
22 views

proper way to add css using functions.php?

I asked this question before and the solution worked at that time when I asked! However it is not working anymore for some odd reason. I was hesitant to 'ask' the question again but I can't seem to ...
-1
votes
0answers
28 views

How do i change the text and icon of Woocommerce social icons in WordPress on the product archive pages?

In my Woocommerce single product page, I have social share buttons that i would like to change the text, as well as each icon. For example, change the facebook from "share on facebook" to "share on fb"...
0
votes
0answers
25 views

Offset with ajax load more posts duplicates

I have a shortcode that gets posts. I am using the shortcode three times on the page. The first time I grab the first 6 posts, the second time I offset by 6 and grab the next 4 posts, the third time I ...
0
votes
0answers
9 views

Linking plugin submenu links to PHP page

First time making a custom plugin so please go easy on me! I'm attempting to build a custom plugin with an admin panel. I have created the menu without too much trouble, but I'm now struggling to make ...
-2
votes
0answers
25 views

elseif is not working in wordpress

Actually it is integrated with mycred I have 3 point types I want if balance is less than order cost then it will deducted from second point type that is why I have included if, else if. ...
0
votes
0answers
12 views

Display all description with the same taxonomie in google map marker using ajax

For the moment I can not display all the descriptions related to the same taxonomies. I only display the most recent alert. my goal and to display the descriptions of all alerts related to each ...
0
votes
2answers
37 views

Static Page with php echo [duplicate]

I build a static page in my WordPress root folder. Now I'm trying to include a list of my categories with echo clpr_categories_list();. Its not working because I some how have to tell the static page ...
0
votes
0answers
19 views

Display posts from a custom taxonomy

So I want to display on some blog posts some related Woocommerce products. But I don't want to manually select the products each time, so I created a custom taxonomy with pods, name group, then on ...
0
votes
0answers
12 views

Unit test for wordpress plugin

I have followed wordpress office blog -->https://make.wordpress.org/cli/handbook/plugin-unit-tests/ to implement unit testing in plugin. I have been able to write a simple test on one of my method of ...
0
votes
0answers
15 views

I need to change code in plugin admin file with using another plugin don't touch main plugin

I need to change this code // wildcard postcode ? $wildcard_position = strpos( $rate_postcode, '*' ); // The rate has a wildcard match only the beginning of both if ( $wildcard_position ...
0
votes
1answer
20 views

Is admin section completely customizable in terms of styling?

Can we completely customize the WordPress dashboard in terms of appearance and style? I have uploaded the image: Or Wordpress doesn't allow such conversions. I mean the right-hand side part shown ...
0
votes
1answer
14 views

How to separate categories with commas?

I have this function that displays the specified hierarchy level category of a post. For example <?php display_cat_level(0,true); ?> will display the top/parent category, while <?php ...
1
vote
1answer
37 views

How to get next image with this code from same post?

I want to show images in my single-content.php file. I have almost 20 to 25 images in every post. I want to print them with below code one by one. I have to change one line in code for every image for ...
0
votes
0answers
14 views

Need data to go into 3 columns using PHP

I have post data that I have filtered via php in wordpress. I am trying to get the post data to flow into 3 columns. I have it going into 1 column, but I don't know how to get it to go into 3. The ...
1
vote
1answer
18 views

Admin username and password

I use ceber security plugin which protects my site again malicious attacks etc. I checked today and there were over 20 lock outs. I checked ip addresses and there were no constituencies, they were ...
0
votes
0answers
20 views

WordPress displays HTML Special characters while sharing post on Social Networks

I am developing a WordPress website. In wordpress, when I tried to share post to any social network, it displays special characters like "&#8217". For example, if post content is this, "To me ...
0
votes
1answer
24 views

wp_head makes my custom page template not work in Customizer?

I have a weird issue where if I am in the Customizer and visit a page which uses a custom page template I made it doesn't load the site in the preview. But I can see that it loads in the console. I ...
1
vote
4answers
34 views

How can the plugin directory path be returned into <script> </script>?

How can the plugin directory path be returned into <script> </script> instead of hard coding the path? Here is the custom-page.php: <?php get_header(); ?> <script type="text/...