A function is a sequence of program instructions that perform a specific task. It is packaged as a unit that can be used wherever the according task should be performed.

learn more… | top users | synonyms (2)

1
vote
1answer
38 views

My new button is in the wrong place

Initially, I was trying to have the "Add to Cart" button change to "Make an Inquiry" based on the condition of availability and whether there was a price inputted, or not. I kind of got the ...
0
votes
2answers
515 views

Passing postid of Testimonial Custom Post in Shortcode Parameter

I am trying to create Testimonial custom post and display using shortcode function create_post_type() { register_post_type( 'testimonials',//new post type array( ...
1
vote
1answer
573 views

How can I add a Custom Button to Add or Edit post / page next to Add Media?

I'm trying to add a custom button nearby the Add media on the wordpress Add and Edit Post/Page. How can I do that? Thank you very much for your help!
1
vote
2answers
4k views

Getting the post_id in wp_ajax function

I wrote a custom AJAX function in which I have assigned a post type to be a child of another post type. In one function I am looping through those child posts, and I want to update the database to ...
2
votes
1answer
33 views

How to Add a Random Custom Gravatar in the WordPress Comments?

I have a client that has 5 different gravatar images, and would like them to be randomly used as the thumbnail for people's comments that have no Gravatar. I know how to change the Gravatar to a ...
0
votes
1answer
415 views

How to add 'data-caption' inside an anchor tag

bellow is custom gallery code. function custom_gallery_shortcode( $attr = array(), $content = '' ) { $attr['itemtag'] = "li"; $attr['icontag'] = ""; ...
6
votes
1answer
131 views

Does hooking into the same action multiple times drain memory?

Currently I have three functions that run on pre_get_posts. I call them like this: add_action( 'pre_get_posts', 'private_groups' ); add_action( 'pre_get_posts', 'search_results' ); add_action( ...
1
vote
0answers
20 views

meta_query not working as expected

I have 3 posts that each have two meta values. The first meta value is one that they all share (ac_parent_event). The second is one that is unique to that post (ac_thischild_date). For this function, ...
0
votes
1answer
742 views

Load post attached images on a single page site with fancybox

I'm trying to make a single page site that will display posts as thumbnails in some part. Then if a thumbnail is clicked, I want all the images contained in this post to be loaded with fancybox while ...
-1
votes
2answers
31 views

load_plugin_textdomain error

I receive this error while debug mode is enabled: Notice: load_plugin_textdomain was called with an argument that is deprecated since version 2.7 with no alternative available. in ...
1
vote
0answers
24 views

Can't find infinite loop cause

I am working on the below function which will eventually create a set of posts based on meta data entered into a "parent" post. I'm running into an infinite loop when hitting the save button, which I ...
3
votes
2answers
6k views

Using wp_get_nav_menu_items() to list children of children pages

I'm working with a Genesis Based Theme and I'd like build a Page/ Child Page menu structure. That part I can do with the help of some code produced by Bill Erickson. Essentially what I'm trying to do ...
2
votes
5answers
3k views

Make sub menu items a main link in the admin menu using fuctions.php

I am trying to customize the admin area using the functions.php file to make things easier for my clients. One request I have got before and hope to be able to accomplish, is to move some of the sub ...
1
vote
1answer
21 views

Unique sequential reservation code

I have a situation where I'm re building a tour transfer reservation site, I've created the reservations cpt's and each time a user place a reservations this automatically post as a new reservation. ...
0
votes
1answer
65 views

Do we need to change our child function.php to require/include child dir files when we add an over-riding file.php into the child theme

With child themes we are supposed to leave parent functions.php in tact and extend it with the child functions.php. However parent functions.php typically define a whole load of include/requires which ...
1
vote
1answer
1k views

Only let plugin add actions to wp_head & wp_footer on single posts

I'm using a a plugin (Comments Evolved) on a recently built site. The issue I'm having is that this plugin globally enqueueing and adding actions to the head and footer of all pages. I'd like to ...
0
votes
1answer
666 views

Remove Header and Footer in iframe

Many people embed my website's pages in their websites as iframes. I want them to don't take my footer, header and a specific division in those iframes. Since, footer, header and mentioned specific ...
1
vote
2answers
5k views

How to Add Image to Wordpress RSS-Feed with no Plug-in?

I have searched for adding featuring image to rss feed with no plug-in for WordPress. I have found some examples and applied how it was instructed. But All I have got now is nothing. Still can't ...
1
vote
0answers
20 views

bulk change of image setting “link to” to “link to: image url ”

i want every image present on my wordpress site with setting "link to: none" or "link to: post url" became in "link to :image url" ho make this for old post and for new post ? i tried this code in ...
1
vote
2answers
631 views

Update user meta of author when post content is viewed

I have a value that I'm trying to store as user meta for authors on my site. I need it to update itself every time the content of a post is viewed for that author. Here's as far as I've gotten but it ...
1
vote
1answer
34 views

Cannot save CPT meta box

I swear I have tried every tutorial, and looked through every Stack Overflow thread to figure out what I'm doing wrong... I'm creating a custom wordpress backend for a church that includes a place for ...
1
vote
0answers
17 views

Displaying Login form with Shortcode

So I am trying to display a working version of the default wordpress login form on one of my pages. There is code in the functions.php file that creates the shortcode and as far as I know it works ...
2
votes
2answers
802 views

Using plugin functionality in external php script not working

I am encountering a strange problem which I couldn't solve so far. I'm calling a .php script via cronjob (Debian/GNU Linux). To use wordpress functionailty I added: define('WP_USE_THEMES', false); ...
1
vote
0answers
12 views

Categories as main menu items and subcategories as nested lists

I am new to WordPress and am trying to make my website. Would it be possible to list categories and subcategories as a nested list with links in the main navigation menu. What am i trying to achieve ...
1
vote
1answer
25 views

Multiple Loops Inside a Function

What I understand from the CODEX, (https://codex.wordpress.org/Class_Reference/WP_Query#Multiple_Loops). then I'm trying to do a list of posts like this: <nav id="cbp-hrmenu" class="cbp-hrmenu ...
1
vote
2answers
29 views

Change WP attachment name to postid during upload only for post type

I know there is many solutions how to rename attachment while upload files to postid. I got correct solutions that really works fine is: http://wordpress.stackexchange.com/a/30767/86517 (I'm new and I ...
2
votes
1answer
34 views

How to override functions.php in child theme?

I have a theme and I need to override some specific parts|behavior of it specifically on the functions.php file. I know the best practice here is doing this at child theme by placing a custom ...
1
vote
2answers
25 views

Wordpress Page Restrict

Im currently using a theme that has template pages, and they notified me that I cannot use any page restriction plugins, as for that would only work on the default template page. Id like to restrict a ...
1
vote
0answers
29 views

ajax category filter

I know this is a big ask for you guys, but i can't seem to figure this out. I found this page : http://www.bobz.co/ajax-filter-posts-tag/#comment-28112 it shows how to make a dynamic filter for post ...
1
vote
0answers
37 views

Change logo based on incoming domain

The agency I work for are trying to get a client's logo to change based upon the incoming URL. Now, we have 4 different URLs, therefore 4 different logos. Currently, we are using an if/else ...
1
vote
0answers
11 views

Woocommerce Storefront WordPress Ignore Media Gallery Images and use External 3rd Party Host

OK, firstly we have done this before using Magento and it worked well, but with WordPress? Well, here is the problem and the plan... The Problem For a few reasons we wish to use a 3rd Party host for ...
1
vote
1answer
19 views

Is checking whether the blog is installed necessary?

My Wordpress site has become kinda slow and unresponsive, so I am trying what can I do to speed it up by eliminating unnecessary database queries and other things. I stumbled across suggestion found ...
0
votes
1answer
50 views

how to make custom ajax handler?

i'm trying to make custom ajax handler because the admin-ajax.php is taking to long to handle ajax requests from 7s to 10s so i google it and mange to do some custom ajax-handler.php like this ...
0
votes
1answer
13 views

Create 2-layered dropdown menus for custom taxonomy and custom post type

I want to display one dropdown menu with a list of values for a custom taxonomy. My taxonomy is "issue-year" and the dropdown would look like this: <select name="issue-year"> <option ...
0
votes
0answers
50 views

enqueue css in a wordpress plugin condition

I have found a bug in a wordpress plugin /plugins/woocommerce-eu-vat-assistant/ In checkout page if the option "Added possibility to make EU VAT field compulsory when the customer enters a company ...
1
vote
2answers
40 views

PHP code inside shortcodes

Basically, I have this line of code: <?php echo do_shortcode('[O_U user_name="operator" blocked_message="This page is restricted for guests."] **Content Goes here** [/O_U]'); ?> Now, inside ...
1
vote
3answers
79 views

How to add background image control to page admin controls?

I understand that each page is assigned its own class such as .page-id-22 & I can use that to assign a background image to it using the stylesheet but I've seen a theme that adds a control to the ...
0
votes
0answers
22 views

Moving CDN jQuery to footer does not work?

What I want to achieve: Change the default JS to Google's CDN --> this works Move the Google CDN to the footer --> this does not work My code: function my_init() { if (!is_admin()) ...
1
vote
1answer
26 views

Checking array against author id in loop

So I have a function in Wordpress with a plugin that returns a list of friends as an array. The function code is here: function friends_get_list($tmp_uid, $friend_status=1) { global $wpdb; ...
0
votes
1answer
31 views

Adding product to WooCommerce cart [closed]

I have a product category called mobile. In every mobile category product purchase I need to add a free product and it's ID is 1245 to the cart automatically & customer needs to see a message that ...
0
votes
0answers
18 views

How to let users “follow/subscribe” tags (part is working)

I've searched for this for a looong time; My users should be able to follow/subscribe a tag than on a second front page, they only get posts from the subscribed tags. In the following example, in the ...
1
vote
1answer
33 views

wp_dropdown_categories and custom attribute

I'm using this jQuery plugin to handle select element on my site: bootstrap-select Unfortunately, I can't found any option which allow me add a custom attribute to the select element, for e.g: I ...
2
votes
2answers
56 views

Theme options WP Editor

My text editor in Theme Options doesn't have font color option. How can I add that? I've searched around the web, but no luck. On regular pages and posts I can see the font color option. I'm using ...
1
vote
1answer
72 views

Set the transport of the Customizer 'header_image' core setting to 'postMessage'

To activate the Customizer core section Navigation (ID: nav), you need to: add_theme_support( 'custom-header' ); I already tried to make the transport of the Customizer header_image setting ...
0
votes
4answers
536 views

Dequeue script to prevent javascript event conflict on wordpress child theme

I've built a child theme of Divi Theme to use with Buddypress. So far so good, except for a script conflict on commenting buttons. The theme load a javascript (js/custom.js at 2642:2662) with the ...
0
votes
0answers
51 views

Save WooCommerce custom field values without “Updating” Admin Post

I'm creating a website that is on the WooCommerce platform and what I'm essentially trying to do is add another option to the sorting feature of the plugin by using a manually created custom field ...
0
votes
1answer
33 views

get second ID from array

I need to get the second attachment ID from this function and put it into a separate custom field: add_action('pmxi_saved_post', 'replace_thumbnail', 10, 3); function replace_thumbnail($id) { ...
11
votes
3answers
461 views

How to deprecate a function used in a plugin?

One of the functions I'm using in my plugin is polluting the global scope with a name that could collide with another function (used in another plugin). So, I guess I should deprecate it. But how ...
1
vote
1answer
21 views

How to customize a permalink (URL) structure?

i am using $post->guid to get the URL of an attached file to my post. the output is something like this: http://example.com/foo/ [where foo is the file name]. now i want to make a URL like ...
1
vote
0answers
37 views

Default Custom Field Value Automatically Update

I have created a hidden custom field with a php function as its value. Like so -- $value_rating = get_post_meta($Property_Id, 'vr', true); <input type="hidden" name="vr" class="form-control ...