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
0answers
4 views

How can I set and use a cookie on page load?

So I can set a cookie using the below code, and use the cookie I have created when the page gets refreshed problem is I need to set the cookie and use the cookie when the user first loads the sites. ...
-3
votes
1answer
19 views

PHP if url extension action=discussion condition use [on hold]

I want use some style only for url extension /?action=discussion How can I use it by PHP condition?
0
votes
0answers
7 views

How to customize Generate-Pro theme blog posts?

So how do I customize each blog post entry for the Genesis Generate Pro Theme? Specifically I want to: 1) Add a mailing list optin from GetResponse by pasting the following code at the bottom of each ...
0
votes
0answers
14 views

How can I include user meta information in the resulting array of a WP_User_Query?

I'm trying to accomplish some fairly complex custom functionality on a custom WordPress site. The client has an 'About Us' page that includes a list of all team members and their pictures. We're ...
0
votes
1answer
25 views

how to enqueque code in a php file from functions.php

Im building a website with wordpress, using a child theme. there is a file in the main theme folders, called entry.php that is where I need to add a bit of php at the bottom of this document. I don't ...
0
votes
1answer
12 views

Cannot access variables within a widget

I'm currently learning PHP and Wordpress development from a Java background at the moment. How do I access variables in public function Example_Widget() from public function widget( $args, $instance ...
0
votes
2answers
24 views

Use existing image sizes for WooCommerce

I've built a theme and have set the following image dimensions via functions.php: set_post_thumbnail_size( 1064, 347, true ); // Upload @ 2128(W) x 708(H) add_image_size( 'standard', 352, 235, true ...
0
votes
1answer
15 views

How to add next height number in Order Attributes inside the Add new page. [duplicate]

By default, when a new page is added it will be given the next highest number not already assigned to a page.
0
votes
1answer
11 views

Adding custom field in menu options [duplicate]

Please take a look at this image Is there's anyway I can add another field called "Font Awesome Icon" for the user to write the icon class and the output should be like this:
0
votes
2answers
25 views

Creating Wordpress Shortcode with Variable

please forgive me I'm relatively new to PHP... I would like to create a shortcode called [city-name] and have tried placing the following code in my functions.php file: function get_city_name() { ...
0
votes
0answers
15 views

Call to undefined function problem [on hold]

I'm really blind about this one ... problem is that it seems my Wordpress website which has one of real estate themes installed can't load properly (it loads partially with this error shown): Call to ...
0
votes
1answer
12 views

WP_Query in functions.php overrides global $post object, even with wp_reset_query()

I've written a function that grabs all posts that are drafts and puts them as a dropdown in my toolbar for easy access to complete. This works just fine. The problem is that it seems to mess with my ...
0
votes
0answers
9 views

How to parse a post and change the way a gallery item is rendered?

I want to use this plugin http://final-tiles-gallery.com/index.html to display the gallery the users insert in their posts, for that I need to use an specific HTML structure so the plugin works, I've ...
0
votes
0answers
14 views

Loop a Custom Post Pagination

I am having a little trouble trying to get my custom post type pagination to loop. The idea to my pagination is to only display a next field with the title of the next post. Once you hit the last post ...
2
votes
2answers
83 views

Displaying Widgets

During theme development, I understand how to create basic widgets within the functions.php file. However, when it comes to displaying the widget within a theme, is there a preferred way to display ...
0
votes
0answers
8 views

Quicktags external functions file

I have added shortcode buttons to the WordPress tinyMCE text editor using the WordPress quicktags function. This works fine when in functions.php, however I need it to be in an external functions ...
0
votes
0answers
19 views

How to make post title determine category in wordpress

Is there any way to assign a post automatically to a category depending on the title of the post ! Suppose : Post title - This is a test post I want the post to automitically assign to category ...
0
votes
0answers
20 views

Pagination in Search result

How to do a pagination in search result? I have already an excerpt script. All I need is a script for pagination. Pls help me. Thanks function wpse_allowedtags() { return ...
0
votes
0answers
10 views

Merge PHp script into Wordpress MU for multi-tenancy

I have a PHP script with 2 database tables, one of which is named "options". I have installed a fresh Wordpress install, and I noticed the database table "options". I would like to create a ...
0
votes
2answers
41 views

Custom field not updating via functions upon publishing

I've created the code so that on publish of the page, the custom field 'bookinfo' in the page is automatically generated but its not doing anything Below is my code in in functions.php:- <?php if ...
0
votes
0answers
21 views

Pass max posts to Javascript

I'm doing a fairly standard situation where posts are loaded with AJAX via a list. I'm having difficulty passing from WP/PHP to JS when the max posts are reached. Here's what I use to enqueue assets ...
1
vote
1answer
30 views

WSoD being caused by this piece of code

This is a function I'm writing which is supposed to post an input along with some other information, to a database. As of right now, activating the plugin produces a WSoD, when the function is removed ...
0
votes
0answers
14 views

How to change html generated by wordpress media uploader

I have managed to change the output of wordpress media uploader using image_send_to_editor exampled below (where the output is image:($url)) However I want to do the same with other files like ...
0
votes
0answers
38 views

How to add pagination into post showing

I have created a plugin to display all posts on any page by short code. But how do I add pagination? global $wpdb; query_posts('cat='.$cat); $table_name = $wpdb->prefix . "advertisement"; ...
0
votes
0answers
29 views

Integrate WP Tiles into existing loop (index.php) and theme

I want to integrate WP Tiles directly into our Wordpress theme and into our existing loop but their documentation is pretty thin and I can't find much in the way of examples so not really sure how to ...
0
votes
0answers
44 views

WooCommerce nonce field undefined [on hold]

Within my theme I am facing the follow error of the nonce_field function: Fatal error: Call to undefined method WooCommerce::nonce_field() in ...
0
votes
1answer
27 views

Dequeue Script Using Functions.php

Hello I am trying to dequeue the script "jquery.favorite.js" found in my enqueue.php: // WP_ENQUEUE_SCRIPTS static function wp_enqueue_scripts_callback() { global $javo_tso; ...
0
votes
0answers
17 views

Flickr Widget not working [on hold]

I am currently trying to build a flickr widget with the help of this tutorial. I don't know what is the use of API Key and phpFlickr as mentioned in this tutorial. I did everything correct but some ...
0
votes
0answers
12 views

Restrict Media Library to one user except for admins

I have this function to restrict the media library to one user. However I have a few admins who need access to the whole library. How can I make all of it available for admins only ? /*restirct ...
0
votes
1answer
61 views

Updating site content after an AJAX call without a page reload

I've created this PHP function that deletes a product with an id passed by an AJAX call: function deleteSelectedProduct() { if ( isset($_POST['productToDelete']) && ! ...
0
votes
1answer
18 views

disable WP_error: authentication_failed

I am modifying my wp-login.php but from within functions.php (in order not to hack the core). I need to disable one WP_error with code: authentication_failed. if i hack the core and modify ...
0
votes
1answer
23 views

if statement for wordpress default featured image on single post

I'm creating a website and have inserted a blog, in my if statement the home page has a specific image to use and then of course my pages will use the featured image I choose per page. I'd like to ...
-1
votes
0answers
26 views

Can't add a new metabox, help needed. Using CMB2 [closed]

A friend installed the CMB2 plugin on my WordPress for some WooCommerce modification I needed. Now I need to add a new metabox but I am not in contact with that friend. So I need some help: ...
-1
votes
1answer
18 views

Passing HTML in WordPress Shortcode arguments

I've searched a lot but didn't find a solid answer for my question. So I'm posting a new one here. If someone know how to do it, please answer it with an explanation. Lets say I have a shortcode ...
-1
votes
1answer
36 views

How do I make my child theme's CSS update when I save it?

Current System WordPress 4.1.1 Theme: Child theme of Lovecraft Issue Summary My theme, a child theme of Lovecraft, is calling the stylesheet with the URI ...
1
vote
0answers
47 views

Create new user without password

For a specific use case, I need to add users only by username and email without having to input a password for them. Right now if i try to leave the password field empty, it displays an error. How ...
0
votes
0answers
20 views

Limit Taxonomy Parents

I've got a custom taxonomy set up as hierarchical, with a custom function to limit the number of categories the user can select to one. I also need to limit the depth that this custom taxonomy can ...
0
votes
0answers
15 views

Extract a WordPress shortcode attribute from function and apply in another one

I try to modify simple AJAX contact form so that it could take shortcode arguments. Specifically I need to send a message about the successful submission of the form, and as well error message based ...
0
votes
1answer
21 views

Every second post different class in blog view

To assign different classes to every 2nd post in blog view in WordPress adding this code into function.php was suggested as solution. Most people claim it is helpful, but to me it just adds odd at the ...
0
votes
1answer
19 views

Function the_content

For some reason on my attachment page template (http://capa.furniture/?attachment_id=1494) I am getting the url of the reduced size image. I do not know why. I am not getting the thumbnail full size ...
-1
votes
1answer
20 views

how can I make content from a plugin hidden when user is logged in? [duplicate]

I would like to make my social icons at the top of my page disappear when a user logs in to my website... what is the best way to go about this and can you give me all options that are possible ...
0
votes
0answers
12 views

Need help displaying array content programmatically [migrated]

I have an associative array that contains key pairs for the titles of a jQuery navigation list that is working for the portion of the code. See left side of the picture below: The problem is on ...
0
votes
1answer
17 views

Class property seems to lose scope, attached to save_post action?

This may be more suited for StackExchange, so if you think that would be the right place to direct my question - please let me know :). So, I have a class with a property of save_list. This is an 2D ...
0
votes
1answer
34 views

main menu page redirects to user ID

I have a site that displays fitness results to clients. It works by showing them a page based on their UID displaying unique charts and graphs etc. I can redirect members to the unique pages on ...
0
votes
1answer
27 views

How to get rid of Ellipsis on Woocommerce [Essential] Theme [closed]

As the picture says I am trying to remove the three dots that follow the end of the blue sentence (shown in the photo). I am also trying to increase the numbers of characters it can reveal. ...
0
votes
1answer
12 views

Wordpress shortcode Issue!

Hi I have developed a shortcode that lists posts from a custom post type depending upon taxonomy terms. But I am having an issue. It's displaying all posts from all terms instead of the terms being ...
0
votes
0answers
22 views

Plugin Boilerplate - Where should I put helper functions?

I'm using the Wordpress Plugin Boilerplate and as it's OOP, I don't see where is the place for helper functions. If I am using this for say a review plugin - and I have a function that generates the ...
0
votes
1answer
36 views

Problem in outputting shortcode

This is my 2nd question about shortcode as I'm learning shortcode. Here is my code: add_shortcode('work-shortcode', 'work_shortcode'); function work_shortcode() { $return_string .= '<div ...
-1
votes
2answers
19 views

Only echo Page Content (not page title & page content together)

I am working on a child theme of the WordPress Twenty Ten theme. I have several pages in WordPress (About page, Testimonials page, Contact page, etc.). I want to only echo the page content (the actual ...
0
votes
1answer
44 views

How to Display a Plugin function (content) on frontpage using index.php

Slightly Advanced Noob Alert: {Sorry}. I'm designing a WordPress Site {No Active Yet}. I have a plugin [feelbox], but currently it displays only on the single post page. There is no option in the ...