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.
3,607
questions with no upvoted or accepted answers
0
votes
0
answers
2k
views
How can I export data without using any import/export plugin
I am making a theme for myself so I have made simple theme options for customization I just want to add export function triggered by a button. I have checked these two examples
Problem: Create a ...
0
votes
1
answer
108
views
Migrating custom php we wrote from functions.php into a site-specific plugin
For our WordPress site (which uses Contact Form 7), we wrote some custom php that runs a background process when a specific CF7 is submitted. We did this within our child theme's functions.php, with ...
0
votes
1
answer
66
views
What is the correct entry point for capturing coverage data
I am on a mission to find out which plugins are used on a large wordpress installation. Furthermore i need to find out which parts of which plugin is used exactly.
So i decided to record some code ...
0
votes
1
answer
22
views
Not able to add new item in wordpress home page
Recently i changed my WordPress folder from demo to main folder so i did changes in wp_options db table.
But now when i add any new item in home page. It is not allowing me to do that. It is not ...
0
votes
1
answer
432
views
Advanced Wordpress SQL Query
after 4 hours I am not able to find solution, how to correctly write the SQL query to echo data from two tables.
I have two tables and I need to "JOIN" theirs data.
First table is wp_users and the ...
0
votes
1
answer
365
views
Use header option on wp-login page with a second logo
Is it possible to use the header image on top of the wp-login.php page, with placement as it would on any other page?
Customization plugins only support 1 image as the logo, but not a header image.
...
0
votes
1
answer
152
views
Display specific main Sub Nav on Woocommerce product pages
So I have two parent elements with sub navs on my site, they're all just normal page menu links. I'm wondering whether I could have a specific sub nav stay visible when on any Woocommerce product page
0
votes
1
answer
199
views
Nested DIV's across functions in PHP, do not seem to work
My parent function (vc_make_graph()), which has main 'PArent DIV', calls several child functions as shown below. Each child functions also has corresponding DIV's - which I am assuming should be ...
0
votes
1
answer
55
views
How to have more than one ID included in the exclude command?
$product_cats = get_terms('product_cat',array('hide_empty'=>1,'exclude'=>8,'parent'=>0));
In the above how do I more add than one id in the exclude field (currently it is 8 and I want to add ...
0
votes
0
answers
39
views
Error when saving wordpress
I have just installed wordpress. I unzipped the files, entered database and admin info, and it all works fine.
However, when I try and make a design change in customizer, then click save and publish, ...
0
votes
1
answer
51
views
How to send logs to plugin owner for a plugin?
I am developing a plugin(that is already on WordPress) and wanted to know that how to do set up to get error logs from customers? Also, any idea on how to omit logs that should only be shown to ...
0
votes
1
answer
60
views
Position a repeated article blocks
https://www.altcinematic.co.uk/
<?php if(have_rows('films')):
$count = 1; ?>
<section id="content">
<div class="content-section">
<?php while(...
0
votes
1
answer
163
views
Search for images that width and height is more than 500
This is my code to get the first image:
function get_post_first_image() {
global $post, $posts;
$first_img = '';
ob_start();
ob_end_clean();
$content = get_the_content();
$content = ...
0
votes
4
answers
2k
views
Where to check in PHPmyAdmin / SQL database for subdomain
After migrating subdomain to new domain, not sure if the subdomain got left over in any of the settings.
Where in PHPmyAdmin / SQL database should I find those subdomain urls and update them to the ...
0
votes
1
answer
31
views
Editable Student file associated with basic User ID
this is a real noob question, so bare with me please.
I'm running WordPress, hosted on ipage. I'm also using Learndash as my LMS.
I'm trying to figure out how to allow certain users (editors/...
0
votes
0
answers
37
views
How do I get object if class is instantiated only like this new classname()
I want to get an object of a class, but class is instantiated only like this.
new classname();
0
votes
1
answer
1k
views
How to change query string with pretty URL in WordPress using .htaccess file
I want to create a SEO friendly URL in WordPress, i am developing a site in WordPress it has several custom pages with custom PHP Script.
I am sending data in id="some text" and matching this text ...
0
votes
2
answers
45
views
Can the $wbdb function be used in wp w/o also loading the wp_load.php
if I want to add access to the db on the wp site.. i know its must simpler to use the $wpdb global.. does this allow you to access a site without including the wp_load.php file in the root.. I assume ...
0
votes
1
answer
78
views
Comparing Dates within plugin using PHP If statement
This is really simple, but I can't seem to make it work. I want the Due Date text to be red if the current date is past due. I want it to be green if it is still not due yet. Also, I set the due date ...
0
votes
0
answers
285
views
HTTP 500 Error after Creating Shortcode
I was attempting to mimic the shortcode for a previously created button so that I could change the text and url destination.
I copied and pasted the code within the php file while utilizing the ...
0
votes
1
answer
676
views
Trouble with checked() for array of multiple checkboxes
I can't get the checked() to return what I expect.
Data:
Options: = array (
'baseball' => 'Baseball',
'golf' => 'Golf',
'hockey' => 'Hockey',
)
Values: = array (
'baseball' => '...
0
votes
0
answers
616
views
Register setting on plugin activation
I want to register an option when my plugin is activated to be used in the settings page.
My first attempt:
function jpsNews_activate_plugin() {
// REGISTER SETTINGS
register_setting( '...
0
votes
1
answer
155
views
what's the syntax for if the image exists get the image?
I want this to display images instead of posts. What would be the syntax for replacing posts with the images on my site? My code currently says while have post then show the post. I want it to be ...
0
votes
1
answer
518
views
If input field has value Require another field - PHP
FORM - http://hoffwebsites.com/CBENT/registration_form.php
I have a form where a parent registers a student.
There is an option to register another child.
What I need to do is if a parent ...
0
votes
0
answers
114
views
Display related post content and custom field content
I'm having trouble trying to display related post content and custom field content from one custom post type to another.
The Custom Post Types and posts are as follows:
CTP1
- page title 1
- page ...
0
votes
0
answers
294
views
How to fix UpdraftPlus's memory issue?
I've tried to restore a backup version of my website through Updraft Plus, a WP Plugin that allows users to backup the website every few days.
However, it cannot complete the backup due to this error:...
0
votes
1
answer
2k
views
(Xdebug Profiler) Why are there two cachegrind files generated for one page?
When I enable xdebug profiler, open a page in admin, it generates two cachegrind files with almost identical name
cachegrind.out.1498219635_761795.crown__minilio_wp-admin_edit_php
cachegrind.out....
0
votes
1
answer
759
views
Wordpress file upload
I have this plugin im making and in the file upload system i have this:
$mimes = array('image/jpeg','image/jpg','image/gif','image/png','application/pdf');
if(in_array($_FILES['attach']['type'], $...
0
votes
1
answer
428
views
Splitting table data to pages with numbers
I want to split table data from a database to different pages, everything is good until now, but when I try to to add (?page=) at the end of the url it doesn't work, it's a wordpress page so the url ...
0
votes
1
answer
61
views
Help with customising love it plugin (use within foreach)
I'm trying to tweak a love it plugin (by Daniel Pataki) which basically uses Ajax to update post meta when viewing single.php - all works fine when applying the funtionality on a single post view but ...
0
votes
1
answer
224
views
Delete post meta front end
I have a simple foreach loop and am putting together a timeline app. I'm using gravity forms to create / edit posts on the front end and am looking for a solution for a button or trigger that can ...
0
votes
0
answers
87
views
Dropdown menu on custom menu
First of all sorry if the title isn't clear.
I have a code for my header menu in my functions.php file for listing in a customized way.
function clean_custom_menus2() {
$menu_name = 'headermenu'; // ...
0
votes
1
answer
58
views
add a value to an external link query in searchform
I have a little issue with an imported searchform in wordpress.
We have imported the searchform here: http://www.campingsosflores.com/en/
All the code is running inside a wordpress plugin.
using the ...
0
votes
1
answer
43
views
Show post/page into div using function
i'm new in php and want to show page content into a div. The call of the content is using function, here is my code but it doesnt works, how can I fix it?
function fields_after_order_details(){
...
0
votes
0
answers
87
views
How to make WordPress search.php display all strings found on pages or posts
What I want to achieve is that when I type for example "house" in the search field, I want my search.php to display all sentences where "house" is written with the link of the page.
Down here is my ...
0
votes
0
answers
396
views
Escaping a Single Quote in str_replace for Nav Function
I'm trying to modify a nav walker so that it displays the menu item's description. I'm basing my solution off of https://themefoundation.com/menu-item-descriptions/, and have provided the function ...
0
votes
0
answers
19
views
Pagination in WP Queries
I've set up a filter on my blog posts, so that users can only display those which have a value matching an Advance Custom Field.
The query works - but only until you click to see the older posts. ...
0
votes
0
answers
28
views
How do I generate formatted permalinks as specified in backend options?
I searched everywhere for this but couldn't find any help. I'm working on a plugin that generates posts from a database, like so:
foreach ( $items as $item ) {
$content = $core->parseTpl($item-...
0
votes
1
answer
197
views
Upload images from one server to an other in wordpress
I'm developing a plugin which getting data as CSV file. Then i should upload the images from an other server to my server using the details of this CSV file.
The problem is the coding which is not in ...
0
votes
1
answer
257
views
I was wondering if it's possible to implement card.js on WordPress
I'm usgin Woocommerce + Stripe for Woocommerce and the credit card form looks simple/ugly and found this https://github.com/jessepollak/card (demo: https://jessepollak.github.io/card/ ) so I've tried ...
0
votes
1
answer
68
views
wp_query beginner
I'm really new in WP in general, but i have experineces on other PHP based CMS. How to and where to i need to implement my wp_query (see below) that triggers a product filter by category and tag out ...
0
votes
1
answer
248
views
How can get all users by current user meta (array)?
I have a block system to make users block each other, My question is how to get all users by current user meta by the array?
When current user is blocked anther user it's saved as meta like this: a:1:...
0
votes
0
answers
210
views
Crop an image after upload on custom account page
I have a custom account page in WordPress where I would like users to be able to upload an image that replaces the default WordPress avatar. I have the upload process working great, but I need to crop ...
0
votes
0
answers
420
views
Display tag links on archive page?
How do I dynamically show a list of all available tags with links to their own archive pages on the top of my customized archive.php page?
Basically I have: site.com/cameras and on the top I would ...
0
votes
1
answer
185
views
Getting a value from a custom field from a page that shares a parent with the current page
I have a page that has a true/false custom field.
What I want to do is output a link on another page that shares a parent with the page with the custom field.
Below is code from Wordpress Reference ...
0
votes
1
answer
100
views
Plugin communication between sites that use it?
There will be one 'main' Wordpress site using the plugin that will need to be able to communicate with 'children' sites that use the plugin.
The main website will have the domains of the 'children' ...
0
votes
0
answers
24
views
wordpress, Category ID
I have created an Id category in primary menu in homepage when I click it redirect good to the second section I have selected . All I wan't to know, is it possible from another page this Category Id ...
0
votes
1
answer
175
views
PHP drop down menu for my get_category child of
I have this code here and I can't figure out how to get it within a drop down menu.
<H3>Availabilities</H3>
<?php
$taxonomy = 'category';
// Get the term IDs assigned to post.
$...
0
votes
0
answers
26
views
Short code into PHP
I am a newbie so apologize if it's not an easy question to figure out. I need to add a read more button into a portfolio gallery (divided in categories) - working in wordpress. I have a plugin called ...
0
votes
0
answers
688
views
PHP get_category() function redeclared
I'm not a developer, hence why i'm asking for the help of you experts :).
I was assigned the task to move a wordpress website (From apache with php 5.4.45 to IIS with PHP 5.6). Once migrated I'm ...