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)

2
votes
2answers
1k views

Auto-add paragraphs to custom field?

hey guys, is it possible to format text in a custom field input box automatically with paragraphs? e.g. like the normal text-widget that has the option to say "auto-add paragraphs" when there is a ...
2
votes
2answers
478 views

Set user loggin status?

I create user with wp_create_user,after succesfully creating a user I need to set his status to be logged in?How to set his status to be logged in ?
2
votes
2answers
978 views

wp_enqueue_script was called incorrectly

Hello I don't know how but now I am getting this error Notice: wp_enqueue_style was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, ...
2
votes
1answer
251 views

Different 'WP_CONTENT_URL' for different subsites in Multisite setup?

I host quite a few blogs on my network (WordPress Multisite) and have their static content served via a common CDN, by simply setting the wp-content directory URL in wp-config.php like so: # ...
2
votes
2answers
1k views

Add multiple custom fields to the general settings page

What I would like to do is to add a few custom fields to the general settings. This is the code that Im using. It works allright but I just cant figure how to add more fields. I would like to create ...
2
votes
3answers
127 views

Where does function_exists() look to decide whether a function exists? [closed]

The documentation says: Checks the list of defined functions, both built-in (internal) and user-defined, for function_name. ( SOURCE: http://php.net/manual/en/function.function-exists.php) Does ...
2
votes
1answer
178 views

Why does including a file in theme's functions.php not work?

For example, if I write some code (e.d. add a custom post type or something) in my theme's functions.php, it works fine. If I move it to a new file, then include() the file in my theme's functions.php ...
2
votes
1answer
124 views

changing function wp_register

how can i change function in general-template.php without affecting this core file on this: if ( ! is_user_logged_in() ) { if ( get_option('users_can_register') ) $link = $before . '<a ...
2
votes
3answers
364 views

Compare post levels and user levels wishlist member

I'm using Wishlist Member plugin and I'm building a function which compares user_levels and post_levels, but I can't get my function to work: check_user_access($userid, $postid){ // get ...
2
votes
1answer
119 views

What is user_trailingslashit() for?

What does the user_trailingslashit() function do, and when should I use it? How is it different from the trailingslashit() function?
2
votes
2answers
69 views

Display All Non-Used Plugins

My company currently has a multisite of about 20 sites, and growing every day. We're trying to go through the plugins and set standards. IE, forms use plugin X. However, we have not found a single way ...
2
votes
1answer
105 views

Set a User as Author of all 'New Posts' posted

An Author 'XYZ' is need to be set as the Default author of all New Posts. Irrespective of the actual Author posting the content, the post should be saved by this author 'XYZ'. Is there a Plugin or ...
2
votes
2answers
898 views

Hide main div if wp_nav_menu is empty

I want to hide the div class "navmain2" if the menu is empty. See code below: <!-- Start main navigation --> <div class="navmain2"> <div id="logo"></div> ...
2
votes
1answer
790 views

Apply custom role capabilities to administrator (without plugin)

I have a custom role that allows access to only a sigle custom post type. This is all well and good, but now it is only showing up for this role, not for admin and super admin. I'm having a hard time ...
2
votes
1answer
421 views

Rewriting search and pagination base

After trying for weeks now how to find a working solution I got rid of most of my functions and trials and just left the pagination function underneath in my functions.phh file: /** * Pagination ...
2
votes
1answer
173 views

Get page slug and assign a variable within functions.php

I have created a lazy loading script using AJAX and JSON for my blog. It works perfectly. However I have 4 different blogs on the same site. These are created using custom post types. I need to get ...
2
votes
1answer
798 views

Can I pass two roles to the function get_users?

I want to get the users of role academic and student. I have tried using the code below (passing an array of roles, but all users are being displayed, so clearly it's not working. ...
2
votes
1answer
497 views

How to generate and display widgets areas dynamically?

I want display different content in sidebar for every category, but as I create new ones I have to create the area for it. How can I have widget areas for every category and also display them on theme ...
2
votes
2answers
1k views

Unable to get_the_content(); of a post in Wordpress via AJAX

I'm trying to ajaxify my Wordpress theme and I use the method described here and I'm now trying get_the_content of post via functions.php. Using jQuery, when I do alert(data) I get the 'title' echo ...
2
votes
3answers
1k views

Search everything (posts, pages, tags, cpt, meta)

I would like to know how to use the built in wordpress search to return results from all content on my site. Specifically, I want to search; posts pages tags custom post type (portfolio) custom ...
2
votes
1answer
1k views

Why is my custom meta box input not saving

I've added the following function to functions.php to add a custom meta box enabling the end user to input a gallery shortcode. I then intend to use this to place a gallery in a specific place on the ...
2
votes
2answers
792 views

Add class to Categories Widget

I have a few default widgets which I am using in a custom sidebar and I'd like to edit its output in my functions.php file. Currently the categories widget and blogrolls are generating an unordered ...
2
votes
1answer
1k views

Add meta data to the menu

I encountered this problem what i thought to be one of the worlds simpliest things, I wanted to add a subtitle to the menu somethin alike this http://img4.imageshack.us/img4/7816/unled10b.png . Then i ...
2
votes
2answers
762 views

wp_remote_post with ssl:// protocol

$response = wp_remote_post( 'ssl://securesite.com', array( 'method' => 'POST', 'body' => $string, // variable is set 'timeout' => apply_filters( ...
2
votes
1answer
61 views

Adjust which tempalte a page uses with a function?

I know if I had a page that had a permalink such as /stories/ then I could create a page in my template called page-stores.php and it would load in place of the default page.php when that page loaded ...
2
votes
2answers
524 views

Best way to programatically add “rel” attributes to page and post images

For single posts and pages, I would like to add certain rel attributes to all the images on the contained therein added with the "Add Image" functionality on the edit screen. The attribute would be ...
2
votes
2answers
218 views

Post the content of a specific “Custom Post Type” post within a post using a shortcode

The posts on our music blog usually include multiple tracks of music. I want to have each individual track be its own entity--a custom post type called "track"--which I want to be able to insert ...
2
votes
1answer
731 views

If function exists, and array is met, echo function?

I have a function like the following: <?php echo my_custom_function( array( 'category_url'=>'My Special Category' ) ); ?> It pulls data from the "My Special Category" and displays it. I ...
2
votes
2answers
3k views

Can't access WordPress functions in file called via Ajax?

I am trying to reload the fresh posts using jQuery. As far as I know, I can't reload the contents of a div inside the page so I reload a file into that div. The problem is that my loaded file gives ...
2
votes
2answers
535 views

How to manually add an item to a submenu in a menu generated by wp_nav_menu?

Hey. I've been trying to figure this out for a long time but can't seem to crack it. I have created a menu using Wordpress 3 menu editor and it's all fine and working. But I want to manually add an ...
2
votes
1answer
245 views

Convert User ID's to User Names in a single.php file

I have a post_meta "thevoters" that store users ids like: 1,2,20 ...etc, How i can turn this id's to User Names to list them in a single page? This will echo the numbers as text, echo ...
2
votes
1answer
428 views

Wordpress change author email notify message?

just want to change a little bit author email notify message(wp_notify_postauthor - pluggable.php),and I'm applying filters on comment_notification_text function myfunction(){ return "<div ...
2
votes
2answers
40 views

Calculate percentage of post by category

Is it possible to calculate the percentage of posts in each given category? I'd like to make a bar chart to visualize the amout of posts in those categories. I thought what one needs would be the ...
2
votes
1answer
44 views

Enforcing password complexity

We need to enforce password complexity in a wordpress site, we used this article: http://www.webtipblog.com/force-password-complexity-requirements-wordpress/ We created the following in ...
2
votes
1answer
25 views

How can I modify the permalink via a filter?

I would like to make a change to the URL's in my href attribute across my while site when the_permalink is called. For example: <h2><a href="<?php the_permalink()?>" Can I use my ...
2
votes
1answer
40 views

Change comment_reply_link URL

I have a reverse proxy pointing my WordPress Blog (CNAMED at blog.example.com) to www.example.com/blog/ Most everything is working well except for comment reply links. Those are skipping the /blog/ ...
2
votes
2answers
2k views

How to override enqueued styles using a child theme

I'm creating a child theme (My first in over 3 years) of a WooCommerce theme and I'm having some trouble with the fact that some of the layout styles are enqueued in the parent theme and I'm having to ...
2
votes
1answer
143 views

How to load some jquery code to make validation in the theme customizer?

i am tring to load some jquery code to make validation in the theme customizer. i have created 10 checkboxes to show some info. but i want to limited the user to choose only 5 checkboxes. so i have ...
2
votes
1answer
34 views

Returning Variables back into a template

If I put a function that I want to use in a template I can put it into functions.php function myfunction(){ echo 'My String'; } add_action('myfunction','myfunction'); and in a template file put: ...
2
votes
1answer
49 views

Modifying Footnote Plugin for Descriptive Title Attributes

I've been struggling for a couple hours now to get this working... Hopefully someone here can help me. I just started using the wp-footnotes plugin, and I'm trying to set the title attribute on ...
2
votes
1answer
284 views

How can one utilize a variable as a callback function name for add_settings_field

I'm trying to cut down on the amount of code that is in my theme options function. I'm adding my settings like so: add_settings_field($k,$v,$callback,$the_options,$the_group,$args); This works for ...
2
votes
2answers
874 views

Issue with get_theme_mod returning a blank value instead of the saved value

I have what seems to be a rather troubling issue with the get_theme_mod function in the latest version of Wordpress. Only on particular servers (of which meet all Wordpress requirements) the function ...
2
votes
1answer
357 views

Adding 'active' class to custom taxonomies using walker in functions.php

I'm trying to use the following code in functions.php in order to show a menu with categories (custom taxonomies actually). I simply want it to show active when on the current page. What am I doing ...
2
votes
1answer
56 views

Actions according to image type and size

I want to do some actions according to image type and size, but the script I'm using is kind of heavy and is skyrocketing my wait time (first byte) from 5 to even 40 seconds (usually it's bellow a ...
2
votes
1answer
130 views

New Plugin: Post update pushes a copy as a revision

I've been working alot with editing of posts after they've been published. I know I can hit update on the post to just update it, but I want to have the journey of revisions available for users to ...
2
votes
1answer
155 views

How to update feed only 2-3 times a week (for Feedburner email)?

So many of you know that Feedburner is a great (free) tool for sending out newsletters. The problem is that if you add content everyday, everyday emails will be sent out. I'd like to control on ...
2
votes
1answer
2k views

Override plugin functions in functions.php

I´d like to override $title = get_bloginfo(); with --> $title = get_bloginfo('siteurl'); Some code from the plugin "Really simple Facebook Twitter share buttons": function really_simple_share ...
2
votes
1answer
162 views

Manipulate Output of wp_list_something: select menu instead of li's

I'm working on a responsive webdesign where my navigation should swap into a select-menu when resizing the window in smaller sizes. Is it somehow possible to add another param to functions like ...
2
votes
1answer
208 views

Clean-up script tags

I want to clean up <script> tags generated by WordPress to produce more semantic output for HTML5. You can already do this for <style> tags using this code attached to the ...
2
votes
1answer
213 views

Multisite, either change the name of sample-page or create new page

Is there a way to either change the name of the default Sample Page or create a new page entirely everytime a user creates a new blog on WP multisite?