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.

1
vote
2answers
27 views

Self deactivate plugins after an action occurs

I'm developing a WordPress plugin. I want to download a file from a server, then unzip and put it inside the main directory of WordPress after the plugin is activated. The process of download and ...
-1
votes
0answers
10 views

Bootstrap not working [on hold]

https://www.startutorial.com/articles/view/php-crud-tutorial-part-2 I based exactly here, but why mime doesnt work
0
votes
2answers
12 views

How to make this code valid only when the value exists?

very new here to php and wordpress coding (1 day lol). This is my code so far, the problem is that when there is no value assigned to this attribute I receive and error message. I know I need ...
1
vote
1answer
14 views

Custom page archive query by url var calling page twice on one of my custom queries?

This is such an odd issue. I will try and break it down as simply as I can. I am creating my own custom page query which works like an archive using url variables to customise the query results. ...
0
votes
1answer
14 views

Exclude category and post from loop in custom category.php

So I created a custom category.php where I have the following loop: <div id="category__product-grid" class="row"> <?php // The Loop while ( have_posts() ) : the_post(); ?> <div class=...
0
votes
1answer
17 views

Notice: Undefined variable: video_type

Hi how do i fix this error? Notice: Undefined variable: video_type wp-content/themes/multinews/framework/includes/post-formats.php 56 Here is the code. <?php } elseif ($video_type == '...
0
votes
0answers
22 views

How to get after hash word from current page url

I've been developing a filtering with mixitup including hash url filtering support in Wordpress. But one of the task, I need to catch up the after hash word and have to pass it into pure php string as ...
0
votes
0answers
18 views

How to display custom seo title before the loop?

So I've optimized one of my archive page title to this add_filter('wpseo_title', 'new_filter_title'); function new_filter_title($title) { if ( is_page('1637') && $...
0
votes
0answers
16 views

Wordpress mod_rewrite not working on php fpm

Today I tried to change the webserver to php fpm and it is really very fast But there is a very serious problem I found when I installed Wordpress, when I changed the premalink to anything but the ...
0
votes
0answers
7 views

Menu to the right of screen on desktop using Bootstrap 4

I'm fairly new to WordPress development and would love to learn as much as possible. I am building a theme from scratch and using the wp-bootstrap-navwalker (https://github.com/wp-bootstrap/wp-...
0
votes
0answers
11 views

show arabic posts on arabic page and show english posts on english pages using $wpb_all_query

I'm using this line to get all the posts with the category "Upcoming Event" $wpb_all_query = new WP_Query(array('post_type'=>'post', 'category_name' => 'Upcoming Event', 'post_status'=>'...
0
votes
0answers
15 views

Add custom URLs in yoast sitemap

I had a separated pages for each user in Wordpress like www.domain.com/user-profile/user/. How could I add these links in Yoast sitemap?
0
votes
0answers
16 views

WooCommerce get products based on the taxonomy

I need to modify the WooCommerce product query because I want to filter the shown products on the shop pages based on the taxonomies for each product. So what I've tried is this here: add_filter( '...
0
votes
0answers
8 views

How to refresh Parent Term List after creating a new category

I want to repopulate parent terms drop down once a new category is created. At least refreshing the current page is enough. I tried to hook into "create_category" hook also. I'm using custom post ...
0
votes
0answers
16 views

Can i use php phar to archive a wordpress plugin source files or few files only?

I want to secure main logic of my wordpress plugin. Only solution i got except encryption and obscurification is by making an archived file of my plugin source files via php phar but how and is it ...
0
votes
1answer
11 views

getting the values of hidden inputs to use them in a php mysql query

Im trying to update a value in the database, to do this I pass the values of the input an ID to another hidden inputs and submit the form via jquery, the values are set in the hidden input (tested). ...
0
votes
1answer
18 views

Detect what link user clicks and Redirect to a specific page for logged in users only

I have a link in my WP website Account link. I would like this to work normally for logged out users. However for Logged-in users i would like this link to take them to another page url. I have tried:...
0
votes
0answers
18 views

How do i show a background image in inline css in PHP? [on hold]

<div class="featured-img" style="background-image:url('images/uploads/stry-teer.jpg');"></div> New to PHP. The image was showing okay in pure html but now I'm converting to php how do I ...
0
votes
0answers
13 views

How to create a custom DOM event? [on hold]

How to create a custom js event that fire a GTM trigger. im using Ninja Popup plugin and i need to fire a tag when a user subscribe through the newsletter form on that popup, luckily that plugin has a ...
0
votes
0answers
16 views

Showing siteorigin widget on category page view

I am using the plugin Page Builder by SiteOrigin and I am modifying my category page to render a snippet of one of my custom widgets inside the single view. How would i render just a specific widget ...
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
25 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
45 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
16 views

How to customise in my code to change the color of posts [closed]

How to customize in my code to change the color of posts. I want to post programming codes. But I want only the codes to change color and other texts remain in black. But they all turn black. So ...
0
votes
1answer
29 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
23 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
13 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
16 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
24 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
20 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
17 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
15 views

Getting custom field data from cart page to checkout page in woocomerce

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
7 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, ...
2
votes
1answer
23 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
25 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
17 views

Adding placeholder text field to woocommerce checkout

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
29 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
9 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
18 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
28 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
24 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 ...