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

learn more… | top users | synonyms (1)

0
votes
0answers
106 views

Filtering with woocommerce data attributes

I'm working on woocommerce based booking system. I want to filter product by availability. Now I have custom data attributes for dates. It's submitting in wp_postmeta table. My date returning array ...
0
votes
2answers
98 views

If else statement based on referral URL

I am trying to display content in a custom template based on referral URL. I put a link in my footer called http://domain.com/?ref=special and image2.gif shows still when I click it and go to the ...
0
votes
1answer
38 views

Save the outputted image into the Media Library, with a different filename and extension

For example, I have this "/image.php" file in my "/theme-directory": header ('Content-Type: image/png'); $im = @imagecreatetruecolor(120, 20) or die('Cannot Initialize new GD image stream'); ...
2
votes
1answer
185 views

How to store the_title() into a variable to reutrn the value, not just echo it

I have a loop, and need to pass one more argument through it. I need to get the current page's single post title, and then use that as the value. I tried going about it like this: $tagz = ...
0
votes
0answers
26 views

Create a simple mu-plugin that appends “?mobile” to all links

I have a wordpress website that is set to switch themes when "?mobile" is present in the url. I'm using it for a specific mobile design that will launch from a particular link. So, instead of ...
0
votes
1answer
26 views

Changing layout with wp_customise

So I'm trying to build a conditional statement to display different layouts depending on the option selected. Having a bit of trouble. $wp_customize->add_setting('layout', array( 'default' ...
0
votes
0answers
177 views

Querying latitude and longitude into google maps correctly

Im have custom fields for lat/lon and querying them into google maps. The query im using works if I know the exact number of lat/lon. $args = array( 'post_type' => 'events', ...
1
vote
0answers
59 views

How to update post meta on uploaded image from a custom form?

I have a custom PHP submission form wherein if I submit the form the entry will be created as a custom post. I am able to update post meta boxes for textareas and input fields but can't get uploaded ...
1
vote
1answer
32 views

do_shortcode with custom field

Ok I suck at PHP, so I'll explain this in "English" first then proceed to code. I've got a custom field in my WP DB called ecpt_imdb - this is the numeric value of a movie from the imdB. For example: ...
0
votes
0answers
34 views

Run insert if no entry otherwise run update with ajax

Below function works with ajax ... but I am getting a null result ... I want that if there is no data in the database then insert operation is performed and when there is data the update should work. ...
0
votes
1answer
74 views

Scrape external webpage for first image and add it to new post

I'm looking for a way to scrape an external page for its first/best/largest image and insert a copy of that image as the featured image of a new post on my Wordpress site. The way that I was hoping ...
0
votes
0answers
59 views

Serializing URL via wp add_shortcode to auto select from option list onload

first time in the wordpress stackexchange community! Great that there is such a thing... Scope: Use of the add_shortcode method to use url string to automatically select options in a scraped table on ...
0
votes
1answer
31 views

Why my query does not run with prepare

Hi Below is my query and it works with prepare keyword on the localhost but whenever I use prepare keyword with my queries on live server the data does not show up and as soon I remove prepare from ...
0
votes
1answer
58 views

blank page when trying to change upload directory

Working with wordpress 4.2.2, when I use this code in child theme function.php to change the attachments upload directory according to each post type : function wpse_16722_type_upload_dir( $args ) { ...
0
votes
1answer
164 views

Callback URL in WordPress

I want to use this service OnWebChange to monitor when a website changes and change mine accordingly. It would notify me via a URL callback to my website URL with a HTTP POST method. What ...
0
votes
1answer
46 views

How to organize functions.php content

When building custom themes, I often add my own functions inside functions.php: <?php function my_function() { // Do something... } Should I organize all my custom functions ...
0
votes
1answer
23 views

How to enqueue assets only on queried pages, excluding the page being queried?

How can I enqueue scripts and styles ONLY on admin pages that have a query attached to them? I have the code below which works, but it also enqueues on the native page of the query. I want to ...
0
votes
1answer
41 views

Archive page if else not working for post_excerpt and post_content

I want to show the excerpt from a post only if it exists. If it does not I want to show an excerpt of the content text of the post. Here is what I came up with: <?php $my_excerpt = ...
1
vote
0answers
68 views

How to make own crop image function for WordPress plugin

I am working on a plugin, in plugin i create an upload meta fields for images to upload one or more images. Its working perfectly and in plugin settings i gave options to users that they set images ...
0
votes
1answer
39 views

Create Customization Controls from Array

Coming from a Javascript background and humbly jumping into WP dev I'm having some trouble with PHP (especially in a WordPress context). Here's what I'm trying to do: Create controls for the ...
0
votes
0answers
211 views

Loop through multidimensional array for values, then interest into mySQL table

I have a package of JSON that gives me something like this: [{"a":"5", "b":"9", "c":"3"}] I have a table with with three columns: a, b, c. I want to create entries into the table to match 'a', 'b', ...
0
votes
2answers
20 views

Adding `post_author` in php

So, I have following markup to show a shortcode: <div class="my_edit_button"> <?php echo do_shortcode('[something]'); ?> </div> Then I am trying to make it so that the ...
0
votes
0answers
80 views

Add extra markup to WP menus

Have been asked to redevelop a HTML website in to a WP theme, it has quite an advanced menu structure and i'm not quite sure how I can replicate it. The second menu item has a sub-menu, but it is not ...
0
votes
0answers
80 views

preg_replace to switch urls

I've searched everywhere here and I just can not find the right setup; I'm trying to take a url and replace it with a non functional url... for example; CURRENT HTML URL STRUCTURE <a ...
0
votes
3answers
122 views

php string inside shortcode does not work

I want to automatically get products from woocommerce for a chosen brand, inside a brand's listing on a other part of the site using Sabai Directory. this <?php ...
0
votes
1answer
22 views

Post class only applying to first excerpt; why?

I have a page with three excerpts. Only the first excerpt is being given the post class, not the second or third. I presume something is wrong in my PHP: <table width="100%" border="0" ...
0
votes
0answers
61 views

Not including wp-load.php in plugin

Okay, so I'm trying to get a plugin approved, and I've fixed most issues except the fact that I'm using require_once to load wp-load.php. I create a button in the admin bar, and there is a javascript ...
0
votes
1answer
413 views

Custom Wordpress+PHP+MYSQL+AJAX form, submit event not captured by Javascript, but does POST data to the DB

I'm building a little form to let users update their contact information outside of the vanilla Wordpress user management systems. I plan to use a simple CRUD setup and throw in some sanitation. I've ...
0
votes
2answers
39 views

how to use php in custom toolbar form

i'm customzing my admin bar/tool bar and i've added login/logout/lostpassword. but when it comes to the registrations form i've met a brick wall function registration_admin_bar() { global ...
0
votes
0answers
27 views

Extract and amend variables from 'like' plugin and put into visual meter gauge plugin

I am trying to extract the total number of likes associated with different posts from the WTI Like Post Pro wordpress plugin, then subtract the number of unlikes and feed this total into a meter gauge ...
0
votes
1answer
90 views

Pass the updated value of aid from form using ajax

I am working in wordpress and I want to fetch the updated value of aid field from form each time a submit button is pressed. There are two submit buttons and I want the id as per the clicked row HTML ...
1
vote
0answers
129 views

woocommerce place order using curl? [closed]

I need to place order using curl in wordpress woocommerce. i already tried this but its not working. My error {"result":"failure","messages":" \n\t\t\t We were unable to process your order, ...
0
votes
1answer
93 views

Create dynamic content from one WP page to multiple other pages

I want to create dynamic content that is taken from a specific paragraph from one page and writes to a paragraph on multiple pages that feature that same content. I am new to PHP and not sure how to ...
0
votes
0answers
99 views

Update a div with ajax result

I am working in wordpress and this is an ajax call and I want the result of a row returned to a div with id #hero. Now since the result is a for loop and hero div is in each row. And the form has ...
1
vote
1answer
29 views

How do I use this PHP library to access OpenGraph data in a child theme?

I'm fleshing out post formats in a child theme. For link-type posts, if a featured image hasn't been set, I'd like to fetch the OpenGraph image associated with the link and display it. I've found ...
0
votes
0answers
104 views

Set cookies based on visitor choose (first time visit site)

i am working on solution to set cookies based on visitor choose. when the visitor first time visit my site, popup uppers with "select branch". so when the visitor select the branch i make the ...
0
votes
0answers
21 views

Call to undefined function wp_email()

Good Day, I'm just new in Wordpress, I have a custom product form inquiry create and all of its data are sent through ajax. The problem is although I included the wp-load.php file for wp functions and ...
0
votes
1answer
31 views

It possible to implement an adhoc php web application with wordpress?

I need to implement a web app in php and I wonder if it would be a good solution to use wordpress or just do it with external php code my web app: Has some panels with forms for the users to fill, ...
1
vote
4answers
235 views

How can I execute some small piece of PHP code in a sandbox area of my WP?

I'd like to execute some small piece of code like the following one: global $wpdb; $rows = $wpdb->query('SELECT DATE(post_date) AS date, COUNT(*) AS count FROM ' . $wpdb->posts . ' GROUP BY ...
1
vote
1answer
185 views

Allow only 1 taxonomy per custom post type [duplicate]

Wordpress allows Admin to select more than one category for a post , I would like to change that so user is allowed to select only 1 category for a custom post type. Please note I cannot remove ...
0
votes
0answers
177 views

WP dynamic featured image - Can't get second featured image url

(I've already opened a thread on stack overflow: https://stackoverflow.com/questions/30079269/wp-dynamic-featured-image-cant-get-second-featured-image-url Hope it's not considered as double) I'm ...
0
votes
0answers
16 views

Admin Editor Issue

I want to enable multiple <br /> tags in the back office editor as user press [SHIFT + ENTER]. Like Gmail Editor. Otherwise I need to disable linebreaks on [SHIFT + ENTER] and it should just ...
0
votes
0answers
54 views

wordpress custom post type with boostrap modal box

I would like to show WordPress custom post type in Boostrap modal box but as the result of codes below the Modal box always loop all the post and disappear. Thank you, Decneo <?php if ...
1
vote
1answer
80 views

WordPress template_include filter not working properly

I am working on a plugin. The plugin make custom post type "product". First i use template_redirect action for redirection to single and category pages. Here is my template_redirect code: ...
0
votes
1answer
28 views

How to keep empty fields from appearing in php?

Please help... I have managed to do some basic PHP coding to call author meta and url information on single post, but I do not know how to hide the empty data fields. Can anybody give me any ...
1
vote
0answers
354 views

How to use update and delete query in wordpress

First i write manually update, delete, insert and select query and execute data with mysql_query function Like this: Select query $prefix = $wpdb->prefix; $postSql = "SELECT DISTINCT post_id ...
0
votes
0answers
27 views

PHP errors are logged but not displayed

On my local development server, PHP errors are logged to the file wp-content/debug.log, but they don't display on the page or halt execution. This problem seems confined to the administrative ...
0
votes
1answer
163 views

Passing PHP Variables to JS using Localize Script

Im trying to pass some variables (author of the post, category of the post, and title of the post) to a js file using wp_localize_script. I cannot, for the life of me get these correct. How can I ...
0
votes
2answers
22 views

admin menu naming

how can I change the 1st child name of the admin menu in wp? I have upload a picture, I want to have a different name of the 1st child of the menu and the parent will be the same. this is mycode ...
1
vote
1answer
29 views

Replace text in post from cvs

I have constructed a post template that i want to use to all post. I use visual composer and some add ons . I need to create post with vcs file but i don't know hot to organize the cvs inside to do ...