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)

0
votes
1answer
1k views

Let users upload image(s) to the post from front end

I want to enable logged in users (Wordpress) to submit posts from front end (among with other data). My form is working great, I add custom post meta data which I later display on custom post page. ...
0
votes
1answer
14 views

Problem in using Customizer

Looking for some help with a customizer problem. I am using following codes to create a customizer which will allow me to upload an image for topic of the week section. owever, the following codes ...
-4
votes
0answers
10 views

Is there any wordpress plugin for reference user get discount on any purchase? [on hold]

Like, there is user who register with site and it takes one unique ID. That user give that ID to their friend and advice to register with that reference ID. And after registration of new user with ...
1
vote
2answers
474 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
1answer
456 views

Auto Populate Custom Field with Complex Value That Increase by One?

Can somebody help me to sort this? I am using WP 3.5.2 and I have "Orders" post type where purchase_order custom field is located. This is the sample of purchase order record: POCOS20130051 PO - ...
0
votes
1answer
24 views

How to call particular funcion when the check box is checked in plugin options page

I'm new to php and wp plugin development, i just created a simple options page for my test plugin, the options page has only one check box, i don't know how to execute some function when the box is ...
0
votes
1answer
14 views

Load WP Admin scripts in a child theme functions file

All, I'm using a plugin that enqueues some scripts in the admin section of wordpress. I want the same functionality built in a page template. I noticed the main difference between is it tries to use ...
0
votes
1answer
425 views

Custom registration form in shortcode getting internal server error 500

I created a custom registration form which works fine when used as a custom page template. I needed it as a shortcode so I created a shortcode using the function below /* Custom shortcode */ function ...
1
vote
0answers
17 views

changing behaviour of get_search_form

I created a function to display a search box and named it my_get_search_form() that is a copy of original get_search_form() function. when I call the function, the output is this: Search in ...
0
votes
1answer
23 views

How can we know we are not in edit page

I want to enqueue a JS file only to my View Page screen(after pubishing page). Whenever I click on edit this page, i want to remove that JS. How can we do this. `if(is_page()){ wp_register_script( ...
0
votes
0answers
12 views

Create a random list of html items within a shortcode in the functions file.

I'm trying to create a function that randomly pulls lines of code for a list of HTML items. Basically, I'm going to have a list of 50 or 100 images with hyperlinks associated with them. I'd like a ...
0
votes
2answers
3k views

redirect wp-login.php to another page

I would like to redirect this page wp-login.php to /login page. So when a user clicks on a link like this <a href="/wp-login.php">login</a>, wordpress will redirect him to /register . I ...
1
vote
2answers
519 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 ...
0
votes
1answer
286 views

Linking Javascript in functions.php file

Below is my raw javascript embeds from my html template. But I cannnot figure out exactly how to add it to my functions.php file. It seems pretty difficult. Can you please assist with the correct ...
1
vote
1answer
2k views

Change ul class=“children” for wp_list_pages?

Hello I'm using this code to print a list of Pages and Subpages: <ul> <?php wp_list_pages('title_li=&depth=2&child_of='); ?> </ul> It outputs: <ul> ...
0
votes
4answers
4k views

remove <div class=“textwidget”> from text-widget

When you add a text widget to a sidebar in Wordpress the widget includes this code <div class="textwidget"> How do I remove this without editing the core? FYI - I think this line is located ...
0
votes
2answers
393 views

How to add icon over specific thumb

I wanted to do the following, and I know its possible, but I don't know how. I'm looking at in_category, but it doesn't make to much sense. Basically what I want to do, for an example on my homepage, ...
0
votes
2answers
2k views

Get the blog page URL set in Options

I have set the blog to be a different page other than the home page. I want to have a link from single.php to this blog page. Is there any function that pulls out URL for the blog ?
1
vote
2answers
115 views

Why does `url_to_postid` return 0 when testing `page_for_posts` Page?

If I set Reading Settings > Posts Page (in other words, the page_for_posts option) to a static page, and then attempt to pass its URL through url_to_postid() it will return 0 - why is it? I ...
3
votes
2answers
23 views

Check if the user has explicitly set an excerpt

Is there a way for me to check if the user has explicitly set an excerpt? I need to call the excerpt only if they've specified something in the excerpt field, and not an automatically shortened ...
0
votes
1answer
28 views

Why doesn't is_page(id) work in functions.php?

When is code in functions.php executed? Is it during the loop? The following does not work when placed in functions.php (not within a function) : if (is_page( 27 )) { echo 'this is the apply page'; ...
0
votes
1answer
524 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 ...
0
votes
0answers
19 views

Advanced Custom Fields: First option automatically checked with dynamic checkboxes [closed]

I am using the plugin Advanced Custom Fields on my site. I am using this tutorial to automatically generate a list of checkbox options based on a set of repeater values on the ‘Options’ page. Even ...
0
votes
2answers
30 views

Can't Write Custom Widget Code In One ECHO

I am creating a WordPress custom widget and I created the below one that is working fine when I add it in function.php. <?php /* ...
0
votes
1answer
266 views

Session is not starting

I've read the usage of session() in WordPress from here and here. And I placed the following code into the very starting of my functions.php: /** * ENABLING SESSION TO THE SITE * Thanks: Shazzad ...
0
votes
0answers
13 views

Function to add image link from php to fancybox js

I've got a single-cpt.php page on my website that has a photos' section this needs to display multiple images of the product/location. At the moment when the photo thumbnail loads a lightbox comes up ...
0
votes
3answers
41 views

Custom meta box in custom post type not working

As a wordpress newbie I am having problems in adding custom meta box in my "slider" custom post type which I used in some old wp theme. I'm getting a warning: Warning: call_user_func() expects ...
0
votes
1answer
315 views

Getting images from media library and get_the_date() not working

I've got a function to display all images in the media library on a page. I would like to display the date of each image, but using get_the_date() only returns today's date. Here is the code I'm ...
0
votes
1answer
21 views

Nested shortCode functions in the functions.php file

I'm trying to get a shortcode function (newStuff) to display inside of another function (oldStuff), but I'm running into trouble. Both shortCode functions are listed below, as well as what I've tried. ...
0
votes
1answer
443 views

Right way to update widget on dynamic new input field

I have code to add an input field dynamicly in my theme. I have testd it, as a metabox and it works. But, not in a widget. First add and update, that codes work, but when I refresh page or try to ...
2
votes
1answer
343 views

Changing post category from dropdown

I am showing a list of posts on the front of my wordpress site which each have a dropdown next to them with a list of category's, which are pulled in as follows. As you can see the form submit button ...
0
votes
0answers
7 views

Accessing current post data through a function

I'm using ninjaforms on my wordpress site and i have a form that is displayed on my post template. The idea behind the form is give the user a PDF file once they have completed the form. I need to ...
0
votes
1answer
35 views

Problem with custom function when I go back with the browser

I have a custom function inside functions.php to show the typical social media buttons for each post listed (last entries, categories and tags pages): //Social Media function showSocialButtons() { ...
0
votes
0answers
27 views

List Most Read Posts from last 7 days (with custom post type and other meta queries)

I am using following code in my functions.php to count the views of the post. // function to display number of posts. function getPostViews($postID){ $count_key = 'post_views_count'; $count = ...
4
votes
2answers
80 views

remove_action on after_setup_theme not working from child theme

I am trying to remove a theme action for an elegant-themes theme using a child theme.. This works when I remove action after add_action code anywhere in the parent theme functions.php. However, it ...
1
vote
1answer
560 views

How to show only one category in breadcrumb navigation

I added breadcrumb navigation to WordPress & I'm facing one problem. Here's the function.php code of the breadcrumb: function ux_breadcrumbs() { if (!is_home()) { echo '<a href="'; ...
1
vote
1answer
426 views

How to set the jpg image compression for specific thumbnail sizes?

This question was asked on Set JPEG compression for specific custom image sizes and answered very nicely by Ahmad M I'd of course comment to that thread but I don't have 50 point reputation... The ...
0
votes
0answers
14 views

Adding stick post button to edit post page

Right now, posts can only be sticky through the quick edit panel. Can I add a sticky checkbox to the post edit page?
1
vote
2answers
2k views

Set posts of a custom post type to be private by default?

Say I created a custom post type called 'Private Posts' ($post_type = itsme_private_posts) and want all posts under the custom post type to be set to 'Private' automatically when published i.e. by ...
0
votes
1answer
28 views

add_role menu pages are not visible

I added a custom role this way: add_role( 'tabellenadmin', __( 'Tabellenadministrator' ), array( 'activate_plugins' => true, 'delete_others_pages' => true, 'delete_others_posts' ...
1
vote
1answer
2k views

Debugging an error: wp_enqueue_style was called incorrectly

I've just uploaded a new, custom theme to find that the container is a fraction of the intended width, and the sections below the home section(this is one single page, long site utilizing ids/anchors ...
0
votes
0answers
61 views

Adding jQuery datepicker to Custom Post Type Metabox

I've created a custom post type metabox which displays and functions fine. The problem is with the datepicker it just doesn't seem to work, when clicking the metabox youre able to type in it rather ...
2
votes
1answer
5k 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 ...
-1
votes
2answers
267 views

display last post modified date in genesis child themes

Since I frequently update posts so it’s crucial for me to display last modified date instead of post published date like following image. Its because I want search engine to display my post last ...
0
votes
2answers
26 views

Function to limit number of custom post types on homepage - TwentyTen

here is the deal... I got hold of this piece of code to change the default post type shown on my TwentyTen child theme's homepage. It works like a charm when I add this code to the functions.php ...
0
votes
1answer
18 views

Ajax resetting my global variable

I am wondering why I can't read the updated value of $_TEST. It seems that $_TEST is being reset with each Ajax call. // functions.php $_TEST = 0; // the variable I want to update with each Ajax ...
0
votes
0answers
36 views

Incorrect output with get_attached_file()

I am having troubles with file encodings while retrieving file names with get_attached_file(). The line: get_attached_file( $attachment_id ); Is getting me results like: ...
0
votes
1answer
26 views

shorthand syntax for custom fields

I'm trying to write a shortcode and am sorely out of practice with this stuff. It's for a plugin Full Width Audio Player and I'm trying to query all tracks within a certain playlist so it will output ...
0
votes
1answer
232 views

Is it possible to override this function/class in a child theme?

Is it possible to override this widget function from a parent theme? I saw this blog, but it dealt with a simpler case. http://venutip.com/content/right-way-override-theme-functions parent class ...
0
votes
0answers
10 views

Call plugin function from button and then forward

I'm new to WordPress plugin development (new to PHP in general) and I'm looking for my plugin to run some if checks and then forward to a new page after a submit/button was clicked. I am currently ...