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]

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.

1
vote
0answers
28 views

Image rotation and editing stopped working in Wordpress after upgrading Ubuntu from 16.04 to 18.04

I'm seeing this error in Wordpress Media editor: "Image rotation is not supported by your web host." I checked on my server and I have php7-gd: php -i | grep -i gd /etc/php/7.2/cli/conf.d/20-gd....
0
votes
0answers
27 views

How to get Post sidebar & footer including html like get_the_content() which only gets content section?

I want to get sidebar & footer including html of current post. Then I want to check a "string" inside sidebar & footer. If "string" exits, I want to enqueue a custom script. If anyone knows ...
0
votes
1answer
27 views

PHP/CSS: Shortcode won't display correctly, and only displays in the head (before content)

Trying to create a shortcode to be implemented to a popup. I'm trying to display four images in a 2x2 grid at the center of the page. The problem is that this shortcode now floats everything left and ...
0
votes
1answer
25 views

Underscore - Self hosted fonts

Trying my hand on building a theme with sass, having a bit of a problem with figuring out how to use my self hosted font in the project. This is probably dirt simple, and as usual I'm overcomplicating ...
0
votes
1answer
12 views

Get a value inside a get_post_meta Array

I am editing a Wordpress theme and want to output a value that's inside an array in the post meta array. My code is: $banner_subtitle = get_post_meta( $post_id, 'header_section_meta', true ); echo ...
0
votes
0answers
14 views

Changing default WPMU emails to be send thorugh Campaign Monitor Transactional emails

I am trying to use CM transactional emails to work with wordpress default emails on WPMU installation. So far I've found the required hooks to do this, but i have a few questions. add_action('init', ...
0
votes
0answers
50 views

Add Product Subtitle to Woocommerce Product Page

Wordpress 5.0.1. Woocommerce 3.5.2 I am building a Wordpress/Woocommerce based Shop page and want to change the standard woocommerce theme logic especially on the Product Page: More specifically I ...
0
votes
1answer
67 views

Array to string conversion error in PHP 7.2 when returning user role as class

Disclaimer: I'm rubbish at PHP, so please bear with me as I'm still learning. I'm getting the PHP error Array to string conversion for the following code: function osu_add_role_to_body($classes = '') ...
0
votes
1answer
40 views

Copyright info change - Corporate Plus Theme PHP [closed]

I have been trying to do this for hours now but just can't get this to work. What I am trying to do is change the copyright info in my wordpress theme which is being pulled from wp-content\themes\...
0
votes
0answers
21 views

Wordpress database error only while loading page for 1st time

I have this error when i open the page...but once i select the city from dropdown list,the error doesn't exist. Error is like this: WordPress database error: [You have an error in your SQL syntax; ...
0
votes
1answer
16 views

Getting an empty space in up sell items

I have the current version of wp, and I'm using the tailor theme, and I have my up sell section set up so items show up. However, if an item is out of stock, it creates a random empty space instead of ...
1
vote
0answers
22 views

user_profile_update_errors hook not executing

I'm trying to use the user_profile_update_errors hook, however it doesn't appear to be executing. I'm calling it like this: add_action('user_profile_update_errors', 'blm_register_result', 10, 3); ...
0
votes
0answers
30 views

Custom register page and retrieving WordPress registration errors

I'm doing a custom login and register page and the login portion has gone smoothly as I can redirect errors back to my custom page because of how wordpress handles this (such as appending the issue to ...
0
votes
1answer
9 views

Can't add to time? [closed]

What's the best way to add to time()? For example: time() + 5 will return 5, not the current unix timestamp with 5 added to it. Any ideas? Thanks
0
votes
0answers
80 views

How do I make comment-reply-button with <span> that takes to comment reply form on click

I do need your help. I'm actually designing my personal blog's theme and I got stuck when I could not code a working comment-reply-button with span element. I know you must be wondering why with a ...
-2
votes
1answer
74 views

Metadata on the WP_Post object

I'm having trouble understanding the behavior of a WP_Post variable (and / or possibly the behavior of var_dump itself). As far as I know, var_dump will inspect all data from a variable. From the PHP ...
1
vote
0answers
28 views

Can an array be used as a meta_query value?

I'm trying to query a custom post type (courses) by grade using WP_Query and Advanced Custom Fields (ACF). Grades (checkboxes) are organized by term (groups). Four grades per term, four terms per ...
0
votes
0answers
19 views

Php find date in meta_value between 2 date ranges

I want to search SQL database using PHP and look for meta_value. The meta_value contains data like this: "FixtureMatch_Id":"391270","Bookmaker":"1Bet","UpdatedDate":"2018-12-14T12:48:57.64"" So ...
1
vote
1answer
50 views

How do I create comment-reply-button using <span> element not <a>

I'm currently working to design my first WordPress blog and I got stuck when I came to code comment-reply-button because I want the comment-reply-button to be coded in span element only not a element ...
1
vote
2answers
39 views

AJAX / Read More: multiple check_ajax_referer() and wp_create_nonce() not working independentely

I have multiple wp_query's on the same page. Each one of those queries has an AJAX "read more" button at the bottom. The problem I'm finding is that I can only get one to work at a time. Whichever ...
0
votes
1answer
97 views

Add custom attribute to product's HTML to woocommerce cart page

I'm trying to add a data-attribute to WooCommerce's cart page. The cart page populates a table with each row being a product that has been added to the cart. I'm able to add a data attribute into ...
1
vote
1answer
39 views

Changing user_nicename

user_nicename has the same value with user_login. I want to change user_nicename value only by using code snippet into functions.php or wp-config.php. Is it possible without using phpmyadmin or any ...
0
votes
1answer
17 views

Multiple WordPress sites with different theme and plugin sharing the same content

I want run Multiple Wordpress websites with different theme and plugin using one database where the content remains the same in all websites. 1- site.com - Main site 2- siteb.com - Should use site....
0
votes
1answer
14 views

Using Wordpress custom post type to display StoryMapJS

So I want to use StoryMapJs on my website, and I want to be able to manage these via a custom post type. I've created a custom post type and fields for each option, but I'm struggling to get them to ...
0
votes
0answers
82 views

Change WooCommerce template for PDF - access to custom field

I want to do some modifications to a template of WooCommerce, but I'm rather ZERO in PHP, so that is why I'm asking some guidance so I could perform my small modifications, which I'm sure are not too ...
0
votes
1answer
20 views

Allow user to choose header style

I am working on developing a simple WP theme that our office will use as a starting point for any future projects that come in. My question is this: How would I go about adding functionality that ...
0
votes
0answers
23 views

function to generate custom field for Mailster newsletter from WPgens referral code

I’m quite new to WordPress – and coding in general except I did a lot of SQL, R Matlab etc during my studies a long time ago so I can learn if I know where to search :-). But php, javascript etc are ...
0
votes
0answers
9 views

WooCommerce: How can I select the catalog_visibility for a product?

I know, as simple as it sounds but I don't get it running: How can I select the product visibility for a product by his id via SQL? This is what I have: global $wpdb; $result = $wpdb->get_col( "...
0
votes
0answers
36 views

Require advice handling a URL redirect from a Third Party. URL Params need to populate and then forward to payment

I'm looking for some advice in regards to how I approach dealing with a redirected URL with params. I have a client, let's say Client #A. They have a WordPress website we previously created with ...
0
votes
2answers
21 views

Anyway to output the registration form like the login form with wp_login_form()?

I'm trying to create a dual login/register page with WordPress and so far I found out I can create my custom template and then output the login form with wp_login_form, however I cannot find any ...
1
vote
1answer
36 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 ...
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
19 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
22 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
0answers
31 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
2answers
49 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
9 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
46 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
1answer
27 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
24 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
17 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 ...
1
vote
1answer
35 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
315 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
14 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
87 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
65 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 ...
1
vote
1answer
51 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
29 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
22 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 ...