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
2k views

WP_Query in functions.php

I've got some code that I want to turn into a function. It works great until I wrap it in said function: $args = array( 'posts_per_page' => -1, 'post_type' => ...
3
votes
1answer
237 views

TinyMCE custom stylesheets for different post types

I use a custom stylesheet for TinyMCE, by placing custom styles in editor-style.css in my theme's directory. I am trying to figure out how to use a different stylesheet depending on what post type we ...
0
votes
1answer
319 views

Can you echo PHP code from a variable?

Ok this is a stupid question, and I'm not sure I even asked it right, but this is what I'm trying to do. My wordpress theme supports ad placements and I want to use a advertising manager plugin. I ...
1
vote
1answer
309 views

Show css depending on activity type in BuddyPress activity-loop [closed]

I was wondering if anyone knew of a way to show specific styles to the activity loop depending on the activity type? This is what I had an idea of: function mycustom_act_type() { if ...
0
votes
1answer
352 views

Need help with Custom Post Types and Taxonomies

I'm trying to get my head around CPT and Taxonomies. I've created a section on my WP site called Work and so I've got this in my functions.php file: add_action('init', 'work_register'); function ...
0
votes
1answer
209 views

Showing author box on post detail page

Being new to word-press as well php i am struck at a point. I am trying to display author information along with his picture in the post and have successfully able to fetch all the data from ...
1
vote
1answer
549 views

Limit the length of the Author Profile Biographical Text

What it says on the tin: how can I limit the amount of text a user enters in the Biographical Info area of the User Profile? With a function? Or, jQuery if there is no way with a function? If it ...
0
votes
1answer
746 views

Should I use add_filter for functions in function.php of the theme?

I have written few functions in the function.php file of the theme. Should I use add_filter function for those functions?
1
vote
2answers
317 views

Short_title character problem

I am using this code to shorting the title: function short_title( $after = '', $length ) { $mytitle = get_the_title(); if( strlen( $mytitle ) > $length ) { $mytitle = substr( ...
0
votes
1answer
771 views

Submit Custom Postypes from frontend

I am attempting to create a form that submits data and creates a post with custom fields filled. What I would like to do in step form. 1) Create a custom posttype function called "pickups" (I do not ...
0
votes
2answers
2k views

How to implement a WordPress comments function?

I have loop, wich create news feed, it looks like: (part of news template) News.php <div id="content"> <div class="scrollArea"> <?php ...
0
votes
1answer
85 views

Meta boxes not displayed, data isn't being saved

As the title says, I have a problem in functions.php (I assume it's in there) which causes custom fields to not be displayed on the new/edit post page, and when I add the meta box myself and save the ...
3
votes
1answer
2k views

Use 'add_theme_support' instead of 'add_custom_image_header' In WordPress 3.4

I am debugging my theme using Debug Bar plugin, which is showing me this error (among a few others): Notice: add_custom_image_header is deprecated since version 3.4! Use add_theme_support( ...
0
votes
2answers
177 views

New custom menu created. how to apply it?

i have a childtheme from twentyeleven, i created a 'inicio' (name) custom menu, how can I apply it? tried: <?php wp_nav_menu( array( 'theme_location' => 'inicio' ) ); ?> but not ...
0
votes
2answers
241 views

GET problem in WordPress

I have a strange problem. Any form using GET redirects back to the page not sending the variables. POST does work. I thought it might be an issue with the .htaccess but I deleted it and had WordPress ...
2
votes
3answers
1k views

Functions.php code that only runs on localhost?

I would like to run an add_action in functions.php only if the theme is being loaded from my localhost development site. How would I get this to run only on localhost? function livereload(){ ?> ...
0
votes
2answers
1k views

Meta-Boxes for CustomPostType cause PHP Errors and Notices in “Add New” view

I have a custom-post-type named wr_events. I have quite a lot of meta-boxes in this post-type. The post-type and the meta-boxes itself work just fine. Only thing: No matter at what post-type I ...
2
votes
2answers
815 views

What is the most efficient method for loading widgets in functions.php

I have seen WordPress developers use two different methods for loading custom widgets from the functions.php file. The first: include("functions/my-custom-widget.php"); The second: ...
0
votes
2answers
146 views

Welcome Mails based on user role

hope you can help me. users can chose between subscriber and editor role on my website. now, i'd like to send a register welcome mail to EDITORS only (WITH a specific) text. subscribers must not ...
1
vote
1answer
1k views

Custom Taxonomy Tag Search

I have an existing WordPress search function, what I'd like to be able to do is extend the search to the tags from my custom taxonomy...how do I do that? <form method="get" id="searchform" ...
1
vote
1answer
176 views

Display the number of user comments

I would like to display, on the author/user/contributor page, the number of comments the user has posted, and the number of comments he has received on his posts. Is it possible? Thank you !
3
votes
1answer
2k views

What is the “with_front” rewrite key?

I have the following line in a register_post_type function: 'rewrite' => array('slug' => 'Newsletters', 'with_front' => false), I understand what the line does in general (adds ...
0
votes
1answer
100 views

Changing date query from month

I have been perfecting this bit of code below and ran into an issue. I was wondering how I can change the following code so that it will so the anniversary of any user in the next 30 days, not just by ...
1
vote
3answers
425 views

Can't edit custom post type

I'm using the following code to create two custom post types: Pastebin Link The Spotlight custom post type is giving me the edit/permalink to edit the post. However, the cooking video isn't. I've ...
1
vote
1answer
42 views

Cant remove line that appears above page content

Hi all I am running a multisite I have custom page templates that are working fine however the home page displays the text below, am sure its not in the template and I am struggling to find where its ...
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
376 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
642 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
464 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
249 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
332 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
146 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
197 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
188 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
114 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
563 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
698 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
311 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
63 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
383 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
978 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 ...