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

Sorting date results from a query

I have a site I run which shows the weddings and anniversaries of some friends. I have this running to show the users (and their anniversaries) according to what month it is: $args = array( ...
0
votes
1answer
350 views

Why can't I call a (member) function from within a foreach?

I'm working with a plugin called media tags... The foreach looks as following (simplied as much as possible) foreach($mediatags as $mediatag){ $args = ...
1
vote
1answer
633 views

Need to add class=“lightbox” for every single post image

I got a theme that has lightbox built in, but only for galleries and featured images, not single images. It just needs to have class="lightbox" added to the images source. I'd like a simple function ...
1
vote
2answers
180 views

Check if term is in a taxonomy?

Is there a function that does something like: is_in_taxonomy($term, $taxonomy) Where it returns true if $taxonomy has that $term. ???? Thanks!
0
votes
2answers
448 views

debugging errors.. how to remedy?

I had trouble accessing wp-login.php, so I changed the name of the theme I'm developing to force WP to switch to default. I then turned on debugging and received the errors below. I'm a little puzzled ...
0
votes
1answer
247 views

How to add custom function to pluggable.php

I am working on a WP plugin and I want to add a custom function to pluggable.php (located in /wp-includes). I am calling that function from admin.php (located in /wp-admin) eg. Consider the function ...
0
votes
2answers
324 views

How to only publish posts with image in it

I use a standard loop in my index.php and that shows all the posts beeing posted. What i'm looking for is a code that only shows the posts that have image(s) in it. With other words: i only want to ...
0
votes
1answer
145 views

Making a wordpress page print friendly

I'm trying to use an existing plugin in order to make my posts print friendly. I haven't got any support from the plugin developer. I think I have narrowed down the script to the function that places ...
0
votes
1answer
189 views

Allowed memory size of 33554432 bytes exhausted (tried to allocate 9967617 bytes) in …\wp-includes\functions.php

When a script times out, and there is nothing you can do about it ( cause it's running on a bloddy shared hosted resource where you have 0 control over the script time-outs ), can you run register ...
4
votes
3answers
5k views

Perform an action when post is updated/published

I'd like to run a custom query using some meta data whenever a post is updated or published. Is there something I can put in functions.php to fire when those events occur?
0
votes
1answer
183 views

How to remove “login to reply” from individual comments [duplicate]

Possible Duplicate: How to remove or replace the log-in link for comment replies? I want to get rid of the unnecessary "log in to reply" link from every individual comment when a user is ...
2
votes
1answer
3k views

Proper use of Output Buffer

I'm attempting to use actions to override function calls I currently have throughout a template (to make updating certain replicated sections easier). For example, in archives.php I have the ...
1
vote
1answer
113 views

How to automatically remove links from WordPress Biographical Info?

I want to automatically remove any kind of links from author's Biographical Info instead of doing it manually everytime. Whenever a user adds any link to the Biographical Info box, it should be ...
0
votes
1answer
69 views

How to extend the page editor?

I'm really a newbie to WordPress. I can edit the page via admin Page menu. There is a form submitted on that page. How can I write my own functions to handle this form submission? In other words, how ...
0
votes
1answer
2k views

How to get data from an array using get_user_meta()

I have created a custom user profile field <?php $basics = get_the_author_meta( 'fbasics', $user->ID ); ?> <ul> <li><input value="lesson1" name="fbasics[]" ...
-1
votes
1answer
107 views

Creating custom function in wordpress to return data from database

I have created a custom image uploader for my wordpress admin panel and need to retrieve the data from the wp_options table. I have wrritne the below function: //function to get all slider images ...
1
vote
1answer
551 views

How to Removing fields from the Media Uploader/Gallery on a Custom Post Type Edit Page

This post shows how to remove unwanted fields from the media uploader. It works great, but I want to limit it to a custom-post-type and I can't seem to figure out how to do it. I've tried the ...
4
votes
2answers
681 views

Shared functions.php across multiple WordPress websites

I find myself using many of the same snippets of code for my functions.php file in new websites. Is there a method I can use to create a few different shared functions.php files to use across my ...
1
vote
1answer
310 views

Which action does wp_update_user triggers?

I am working modifying an ecommerce plugin, and it makes uses of wp_update_user() function, and everytime the function runs another table (created by the plugin), gets updated too. The problem is that ...
0
votes
2answers
220 views

Custom styles.css sheet for visual editor

I am trying to use my own styles.css for inside the body of the visual editor for my pages. However, when i add add_editor_style('styles.css'); to the functions.php page it doesnt change anything ...
1
vote
3answers
3k views

get php variable from functions php and echo it in theme template files [closed]

This may seem like a silly question but I cannot figure this out. I've created a variable in my functions.php - and I'm trying to echo it in my template files. I'm guessing it's because of scope. ...
1
vote
1answer
62 views

Does WordPress validate inputs to all functions? (such as get_user_meta and insert_user_meta)

Does WordPress validate inputs made to all built-in functions that access the database to protect against SQL injection vulnerabilities or do we have to validate before passing them?
0
votes
1answer
365 views

Problems with functions.php! Error! [closed]

Suddenly I got the message: Parse error: syntax error, unexpected T_CLASS in /home/spandabe/public_html/wp-content/themes/modularity-lite/functions.php on line 72 when opening my site ...
-2
votes
1answer
961 views

Adding a new layout for genesis

I have added a new layout for the genesis framework called "modalwindow". This layout should only display the content because it is a modal window loading page content (I don't want any of the header, ...
6
votes
2answers
2k views

How to add a custom metabox to the Menu Management admin screen?

Although I am very thankful to the wordpress core team that they have finally integrated native menu management capabilities I get frustrated with some key elements which I would like to change. I ...
0
votes
1answer
205 views

Apply styles to blockquote element with the WYSIWYG editor

I have a blockquote and I can float it left or right if I want by going into the html editor and adding class="alignleft" etc. Is there any way I can make that available to a non tech individual with ...
0
votes
2answers
628 views

Remove swfobject.js in wp_head()

I have gotten rid of the wlwmanifest_link and jquery, since I load it from a compressed version and at the footer, but I can't find a way to get rid of the swfobject.js. This is the code I used to ...
0
votes
2answers
600 views

Require file in functions from theme directory using PHP

I am trying to dynamically get the facebook php sdk from my current themes folder. I am writing this in my functions.php, but all my attempts break the site. See my attempts below... require ...
0
votes
2answers
3k views

Calling a Function in Functions.php from an external PHP script

Preamble I tried to make sure this question was not asked before. I'm new to using StackExchange so I may have failed in doing so. I don't mind rebukes; thick skin and I learn fast :) THE PROBLEM I ...
2
votes
1answer
187 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 ...
1
vote
1answer
518 views

Add custom column in custom post type edit page

I am using the Content Scheduler plugin to control the post expire. The plugin will add a expiry date column on the wp-admin/edit.php in page and post. However it doesn't show in custom post type page ...
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 ?
0
votes
1answer
32 views

What happens to the text in functions.php file outside of the php enclosure?

I have a very basic question. In the functions.php file of a theme, what happens to the text that is outside a function and outside the <?php ?> tags? Can I place notes before and after the ...
0
votes
2answers
245 views

How to store functions in… functions.php?

I want to do some (sometimes really complex) stuff on my pages based on pages/posts IDs', Settings API, etc. Now I've all my functions written directly within page.php file, but I don't want it to ...
2
votes
1answer
221 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 ...
1
vote
3answers
838 views

How many times can I hook into the same action?

I have a theme which includes some setup, using after_setup_theme but I'd like to write my own functions which also need to run after_setup_theme. I'd prefer to keep my stuff in a separate file. Can I ...
1
vote
2answers
220 views

How to speed up a wordpress function with multiple loops?

I am a PHP novice and wrote this function. It is an alphabetical navigation which shows only the letter that have posts in both that letter and the currently filtered "genero" taxonomy term. I use ...
1
vote
1answer
710 views

Passing variables to templates (alternatives to globalizing variables)

I want to make my WP code simpler (there's some mess within header.php, page.php etc.). So, for example, I want to set something like this global: $foo = get_option('foo'); So $foo will work ...
0
votes
1answer
43 views

Check if there is an post to be published in future

I need to check if there is an post to be published in future. I want to use WP functions, no directly access to database via mysql_query. Has anyone some sample of code?
1
vote
2answers
2k views

Default or Preset Content for Custom Post Types

I am trying to modify the code for default content to display based on post type, but so far I have been unsuccesful. The base code is: add_filter( 'default_content', 'my_editor_content' ); ...
2
votes
2answers
3k views

Wordpress 3.1 - How does one add sticky post capabilities to post types

In wordpress 3.1 they finally added the option of allowing posts belonging to a custom post type to be marked as "sticky"... what I can't figure out though is how to enable this so the admin menu ...
0
votes
1answer
116 views

Where do i create my own function in wp-admin

i want to create my own function in wp-admin same like do in wp-content->functions.php, but i don't know where is the function file in wp-admin folder. anybody know where is the function file in ...
0
votes
2answers
331 views

Using is_plugin_active within functions.php

I'm trying to use is_plugin_active within functions.php. I need to wrap my useragent_shortcode function within is_plugin_active because when Contact Form 7 gets deactivated, I get a white screen. ...
0
votes
1answer
284 views

Where is this function's callback getting its arguments from?

This might be better suited to Stack Overflow, thought I'd try here first though. I was walking through this tutorial by Justin Tadlock and encountered the function below being used as the callback ...
1
vote
1answer
439 views

How to Display Image Meta underneath EVERY image in EVERY post

First off, I want to say thank you for taking the time to even read this, I really do appreciate the help this site and it's community has given me thus far. i have looked forever to be able to ...
5
votes
4answers
2k views

Is it possible to remove the “standard” post format?

I'm using post formats heavily on a project, but have no current need for the standard option. Beyond being an unnecessary bit of UI, it actually causes broken behavior if it does get mistakenly ...
1
vote
1answer
489 views

$post object is null

I am trying to use the $post object from functions.php in my theme however if I attempt to var_dump($post) it returns NULL. Here is my code: function breadcrumb_navigation() { var_dump($post); ...
0
votes
1answer
665 views

How to hide image-url if no attachment?

How can I hide the img-tag if there is no attacment? (function is from this tutorial: http://wp.tutsplus.com/tutorials/automagic-post-thumbnails-image-management/) <img src="<?php ...
3
votes
1answer
595 views

When is wp_trim_excerpt() called?

There doesn't appear to be any reference to wp_trim_excerpt() outside of it's declaration - I've checked both the Trac and Xref - when does it work its magic?
2
votes
1answer
872 views

What is the function to get plugin base url in multisite?

I'm using this function plugins_url(). But it always echoes main site url even in subsite. So i'm getting ajax errors like Domains, protocols and ports must match. Lets say my main domain name is ...