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
27 views

List all post title in category using functions.php

I have search all google about this. But many of theme show the way to make a new Template Page which you can choose template type for page. But i want it directly show post title in category by ...
0
votes
0answers
43 views

Dynamically changing menu item link

Hoping someone can help me out - this has been driving me nuts for the past two hours. I'm trying to create a menu item - the menu URL should basically be: http://thesite.com/author/%username% ...
0
votes
2answers
33 views

wp_enqueue_script only works outside of action

So i've been trying to figure this out for awhile now. The following code does not seem to work for me. The javascript file will not be included in the footer ( or anywhere for that matter ) function ...
0
votes
0answers
17 views

Proper way of manipulating a category on your homepage?

I'm using the Genesis theme, and attempting to create a function that finds the homepage AND a specific category, and removes post content under both those conditions. Using my limited knowledge I ...
0
votes
0answers
15 views

custom forgotpassword and hook for additional function

I have other app and a wordpress, whenever if there is a lost password request in the wordpress, it will also trigger for lost password request and other function for the app API.. the password ...
0
votes
1answer
52 views

Warning: array_pop() expects parameter 1 to be array, boolean given

Getting the following php error when trying to add a new post: Warning: array_pop() expects parameter 1 to be array, boolean given in ...
0
votes
0answers
22 views

Create a Function to reference a certain file

Ok, so Imagine user N changes the design on settings to flat ui, the file changes to Framework/styles/flat/style.css from Framework/styles/default/style.css. How can I achieve this? This is possibly ...
0
votes
1answer
21 views

Retrieve contents/page names of various pages for use in a plugin

I'm trying to design a plugin that retrieves the contents of user selected pages and copy the contents into a giant single page. (As long single page websites are trendy right now) These are the ...
0
votes
1answer
60 views

WooCommerce -> wc_enqueue_js not working [closed]

I have a plugin that was using a deprecated function add_inline_js. I've changed it for wc_enqueue_js but it's not working. What I'm doing wrong? $woocommerce->wc_enqueue_js( file_get_contents( ...
0
votes
0answers
8 views

Why WordPress attachments LINK TO settings are not working?

Using this code below, I added some on-hover share icons for all images of the content. But, now these images are not getting any "Link To" setting from authors. I don't know what is the problem. Can ...
0
votes
0answers
28 views

Walker_Nav_Menu check if menu has parent

I created a custom function extending Walker Menu and having some few issues. I got a post from https://wordpress.org/support/topic/how-do-i-know-if-a-menu-item-has-children-or-is-a-leaf showing me ...
0
votes
0answers
73 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
61 views

PHP if url extension action=discussion condition use [closed]

I want use some style only for url extension /?action=discussion How can I use it by PHP condition?
0
votes
0answers
32 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
32 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
21 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
36 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
19 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
16 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
3answers
58 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
1answer
35 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
22 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
17 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
95 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
21 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
23 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
25 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
26 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
1answer
49 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
49 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
38 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
35 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
50 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
80 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
1answer
76 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
24 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
302 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
29 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
62 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
1answer
24 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
93 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
89 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
30 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
29 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
61 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
27 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
1answer
37 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
38 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
32 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. ...