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)

3
votes
2answers
2k views

hook a functions to change wp-config from functions.php

is there a way to hook / filter or add action that would be printed in the wp-config file? lets say i want to add some simple command like "empty the trash" aka define('EMPTY_TRASH_DAYS', 1 ); ...
1
vote
1answer
339 views

Target a certain page within wordpress backend (admin) i.e. Pages > About

How can i progammatically see if the page that is currently open in the wordpress admin is 'About-Me'; I wish to run specific functions depending on the page the user is editing in the wordpress-...
0
votes
1answer
76 views

referencing the current user in a page i created in wordpress

I created a page in wordpress and i tried to access the current logged in user via wp_get_current_user() and am getting error "function undefined". please how do I make this function available in my ...
1
vote
1answer
396 views

Query posts from category based on a filter most favorited

I have one question. I need to query posts from category based on the filter most favorited ( http://pastie.org/2751114 ) which is placed in custom_sort.php to my index.php page This is how the posts ...
1
vote
1answer
267 views

exclude category from WordPress Form function

I have this function and I need to somehow exclude a category number 14 from my submission form. Is there any way to do it inside this function? function retrieve_cat_data($byid = false){ $...
0
votes
1answer
61 views

Adding a filter to my posts

Hello guys I would like to append a link to the end of the content within my post. I currently have this in my functions.php file: function ifcj_comment_link() { global $post; return ' <a href="'. ...
0
votes
2answers
934 views

Problem with WordPress output text ('esc_html' & 'wp_richedit_pre')

I have a problem with output text. When I editing text in the WordPress control panel everything looks normal: http://i.stack.imgur.com/GaIut.png but when I output it to the html: <?php esc_html(...
7
votes
5answers
3k views

Is there any global functions.php file which works for any theme?

Is there some global kind of functions.php file that works for any theme? The problem is here: When I change a functions.php file in any theme, I need to take care of two changes: First, I need to ...
0
votes
1answer
202 views

Theme Demo in live Site

I don't know how to explain this question but let me try, Just Imagine I've a website called xyz.com and in xyz there are 10 themes uploaded and in homepage i'll show name & screenshot of all 10 ...
0
votes
1answer
64 views

Shortcode Variations?

The function below creates a button when used like so [btn]Button Text[/btn] function btn($atts, $content = null) { extract(shortcode_atts(array('link' => '#'), $atts)); return '<a class="...
0
votes
1answer
198 views

Modify code for functions.php with specific twitter user url and hashtags

I am looking to import Tweets with certain hashtags and came across this great response and coding in the link below. My question is how to just get posts from one particular twitter user and will the ...
0
votes
1answer
255 views

How to apply the 'current_page_item' class to an archive page in `wp_list_pages()`?

So I have the following custom wp-query working on my site: function custom_front_page($wp_query){ if($wp_query->get('page_id')==get_option('page_on_front')){ $wp_query->set('...
9
votes
1answer
3k views

Using classes instead of global functions in functions.php

In many themes I've seen (including TwentyEleven) and in the examples I've found online, when building the functions.php file for a theme all functionality is declared in a global scope. To clarify, ...
2
votes
1answer
1k views

Enqueuing Script in functions.php vs on the page

Does it matter if I enqueue a script on just the page I need it to be used? As opposed to functions.php? Or, what is the best practice? In this example I need a rotator just on the front page of my ...
2
votes
1answer
4k views

Targeting specific menu with wp_nav_menu_items

Hey! I have added a wp_loginout() to my header using a snippet in my functions.php: add_filter('wp_nav_menu_items', 'add_login_logout_link', 10, 2); function add_login_logout_link($items, $args) {...
1
vote
1answer
103 views

custom rss templete

The objective is to fetch fields associated with a specific post id to create a custom rss feed. It is required to use functions like the_content_feed('rss2') , the_excerpt_rss() etc outside the ...
0
votes
1answer
565 views

Creating a mobile site by adding a new class to the body tag from functions.php

Essentially is there a way to use a function in functions.php to turn the <body> tag into <body class="mobile">? I have code that recognizes mobile devices but right now it's set up to ...
0
votes
2answers
436 views

Plugin is a widget, but I want to call it in the head, can I?

Full disclosure, PHP and Wordpress are not my specialties. I've got this plugin here -> http://wordpress.org/extend/plugins/ustream-status/ that adds a Widget that will show if my Ustream.tv channel ...
2
votes
1answer
2k 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 ...
1
vote
1answer
107 views

Featured Image Thumbnail Creation

What function or script creates the hard-cropped feature image when a post is saved? Regardless if I stipulate a size when saving the featured image in the media library (like the medium size), a new ...
-1
votes
1answer
299 views

Integrating custom API for post content into Admin interface & Public Website [closed]

EDITED question to be more specific and added bounty in hopes someone has a solid coded solution: So, here is an interesting task I have been trying to find a solution for. I have added a bounty ...
0
votes
1answer
1k views

wp_enqueue_script() not working

I'm trying to add this social-network button: <a href="http://svejo.net/submit/?url=[your url]" data-url="[your url]" data-type="compact" id="svejo-button">Add in Svejo</a> ...
4
votes
1answer
4k views

Get menu object from theme_location

I'd like to get a menu object from its theme location argument. My goal is to output separately the menu name and its items name, url and description. Example of what I'm looking for : $menu = ...
0
votes
1answer
2k views

Simplest Way to Build Custom Archives Page?

I am looking to create a page in Wordpress to output links to all of our posts from every month since we launched the blog. I have seen the archive.php template file in Wordpress, but this seems to ...
0
votes
1answer
914 views

Unable to use get_page_by_title() more than once per page?

On one of my page templates I need to include the contents of several other pages. For example, if my page template is called Fruit, I need to pull in page content from pages named Apple, Pear, Orange,...
2
votes
2answers
1k views

wordpress custom login successful redirect hook

I am using a custom login form imported on my theme's home page through jqModal. In that, when i successfully login it redirects to the same page. I want to redirect based on the logged in user role. ...
-2
votes
2answers
629 views

Getting URL of Resized Image

I have a Wooframework specified question. I'm using Bueno theme with WooFramework 4.5.4 . I'm trying to get url of image which resized with Dynamic Image resizer of WooFramework on single.php. I'm ...
0
votes
1answer
379 views

Filter for replacing the WP_query object for a given category

I'm looking for a action/filter to replace replace a category archive page with the contents of a page. I'm thinking of testing the category ID, and replacing the WP_Query object with a new one ...
3
votes
1answer
1k views

How Can I Access a PHP Variable in Another PHP Function

I'd like to use the $atts variable from the lax_google_map_maker() function in lax_google_map_init(). How do I access it? I tried to 'globalize' it, but for some reason it didn't work. function ...
0
votes
1answer
787 views

Including inline Custom Fields info with add_filter in functions.php

I have a function set up to place some standard text in each post for a Custom Post Type. However, within that standard text I want to pull some unique text from a few custom fields. Not sure what is ...
1
vote
3answers
324 views

Manipulate Permalink

I'm using WPML to translate a website. The only major issue I have with WPML is that you cannot have a page in different languages with the same slug. Therefore www.example.com/contact/ and www....
0
votes
3answers
100 views

Custom user role still showing up after deletion, ideas?

I previously created a new user role called "Owner" which worked fine, however I decided to delete it afterwards from my functions.php since I found it to not be as useful for my project after all......
0
votes
2answers
462 views

Insert content into <title> head tag with function

Is there a hook available that lets you append or prepend text to the <title> tag in the head? I've seen lots of posts about customizing the <title> tag, but they all involve manually ...
1
vote
1answer
514 views

Pass variable to hook. Its possible?

I have this hook created to retrieve user password when he register or update his pass. I dont want my client to touch wordpress core so i was planning to use a hook in wp-includes/user.php All this ...
3
votes
1answer
357 views

Hard Code Pages into a Theme for a Network (multisite) Installation

I'm creating a multisite network and I am looking for a way to have it so new blogs that are created have a couple of standard pages set up automatically. The purpose of these pages will be to ...
2
votes
2answers
2k views

Get password when user registers and save it sha1 into database

im working on a website where the users can connect with iphone to some functions of it by using a sha1 encrypted password. In other words the plain password of wordpress encrypted in sha1. In the ...
0
votes
1answer
1k views

Having problems loading Jquery in functions.php

I'm trying to add some Jquery scripts to my Wordpress site, and unfortunately I cannot link you to the site as I'm working locally. It seems that the Jquery file is being loaded, as well as the ...
0
votes
1answer
4k views

How to save Uploaded image in custom option panel?

I'm trying to add a custom option panel to a new template following a tutorial found on NetTuts. I saved all the code for the option panel inside a file called optionpanel.php (LoL) and everything is ...
1
vote
1answer
408 views

Linking text within textarea of custom meta box

I'm using 'Meta Box Script for WordPress' to create custom meta boxes and everything is working great...except the following: We have a textarea that we want to act, basically as another WP ...
0
votes
1answer
72 views

Numbering lines of code with the <code> tag?

The wordpress tag is used to display code on a page (refer to: http://themeforward.com/demo2/2011/09/12/code-tags-in-post/) but I am having a hard time finding a function that will number the lines ...
0
votes
1answer
6k views

Help me to understand wp_header() and wp_footer() functions

hi everyone please help me to understand the hook functions wp_header() and wp_footer() What does it mean hook functions and what to do
0
votes
2answers
552 views

“Headers already sent” while trying to add a CSS file to my login page?

Every tutorial I've seen on this subject is out of date, so I'm hoping someone here can help me. I want to style my wp-login.php page with a CSS file. But I'd like to do it in a way that won't get ...
0
votes
1answer
88 views

2 small questions: How to redirect to a created page & show that pages title in wp, bp

im trying to redirect the loggedin user to a page i created on the backend, i want to use my index to do so so, i added a do_action wrapped in an if statement is_user_loggedin() to call my function. ...
2
votes
1answer
2k views

How can I tell if I'm on a login page?

There are functions for is_home(), is_blog() is_single() etc... What's the best way to tell if I'm on a page that is requesting that I login? I guess that would just be the wp-login.php page.
1
vote
1answer
32 views

Which file of wordpress manage plugins functionalities?

Which file of wordpress manage the plugins functionalities. For example if a have to insert another rule in a plugin functionality where i go to modify?
0
votes
1answer
42 views

How to know when an user is loged in?

Hello i have this simple problem: when the user is logged an podcast player is shown, other case no. How verify when the user is logged? Im wordpress and php newbie. Thankx
0
votes
1answer
157 views

Do I Need to Prefix Variables Inside Functions?

Sorry, this is a noob question. But, I want to follow the best practices. I read that functions and global variables should be prefixed in plugins. So, for example, myfunction(), should be ...
3
votes
1answer
4k views

How to override function in functions.php of parent theme?

I have created child of theme twentyten. I tried to override function written below /** * Returns a "Continue Reading" link for excerpts * * @since Twenty Ten 1.0 * @return string "Continue ...
0
votes
1answer
401 views

Change default comments form title [duplicate]

Possible Duplicate: Change comments form title on a page by page basis I'm looking to change the comments form title (my theme defaults this to "Leave a Comment" or "Leave a reply to"). I ...
0
votes
1answer
71 views

Removing the custom_image_header from wp_head

I am looking to remove the custom_image_header from the wp_head. I would like to use this in a more manual way throughout my theme. I understand the general approach for this is to include CSS in the ...