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

How would I make a function to dynamically determine if user is logged to change navigation menu text?

I would like to create a function to determine if a user is logged in or logged out. If the user is logged in I would like the navigation menu text to say "My Account" (this is what it currently ...
2
votes
2answers
2k views

delete post also attachments

I am trying to delete a post with its all attachments. This is the function that i came up with right now; function remove_post(){ if(isset($_POST['post_id']) && ...
0
votes
1answer
446 views

using admin functions on frontend

I'm updating my plugin to rely on internal functions of WordPress. I'm about to use wp_generate_attachment_metadata, but this function seems to be only available in the admin section. Is there an ...
0
votes
3answers
109 views

Best way to handle lack of titles in microblogging

I'm experimenting with doing "microblogging" with WordPress and I'm doubtful about how to handle "titles" when one uses different post "formats" (the "formats" may or may not be related with the core ...
0
votes
4answers
271 views

Problem with <code> tag

Where you can see it: http://themeforward.com/demo2/functional-codes The first button is my code, as it should appear. The second button is within <pre><code></pre></code> ...
0
votes
2answers
205 views

How to make modifications only to certain elements of an HTML string on the server-side?

Is there a similar way to select / perform DOM manipulation on the server-side (PHP) like the way jQuery works? For example, if I wanted to modify content of each <pre ...
0
votes
1answer
94 views

Wordpress comment_form() does not display actual comments

Maybe I did not understand the role of comment_form(). After pasting this in my wordpress single.php I get just the form for submitting comments but NOT THE ACTUAL COMMENTS. Is this a bug, or the ...
1
vote
4answers
186 views

Snippets: is it better to add them in functions.php or make site-specific plugins?

Should "snippets" (short code or functions) be added to: the theme's functions.php? OR make site-specific plugins? Which is better from technical, security, performance, etc., standpoint? ...
0
votes
1answer
193 views

How to call a specific value within the functions.php file?

Hi all, I'm a newb here, but hoping someone might have the answer to my question. Within my functions.php file, I have this code: //Contractor Page meta box details $contractorpage_meta_box=array(); ...
0
votes
1answer
65 views

Javascript Function Called Too Early in PHP Script

I'm working on a Google Maps plugin. My problem is that the function that initializes the map, csf_map_maker_js(), is getting called too early-- before the div is defined (at least that's what I ...
0
votes
1answer
76 views

Any adverse effects of adding apply_filters to a function?

I'm going back through my older WordPress theme and making the functions filterable and also adding the function_exists checks. Is there anything I'm not thinking about that this may cause problems ...
0
votes
1answer
611 views

Error on Include php:/usr/share/pear

I'm trying to work with an old plugin http://wordpress.org/extend/plugins/wp-ecards/ (I'm not the plugin author) and I get this error in the php error log and a blank screen when trying to view the ...
0
votes
1answer
244 views

How do I call an external php non WordPress class into functions.php?

All my WordPress files are in: /httpdocs/news/ and the classes I want to call are in: /private/classes/ Would I use the include_once() function or is there a WordPress function? And how would I ...
0
votes
2answers
310 views

Wordpress Categories: Function using custom SQL to return array of specific category IDs

I'm developing a custom theme which uses categories for positioning, all of which begin with an underscore (e.g. _position1). I have an SQL query as below to get a list of these categories (those ...
-1
votes
1answer
161 views

Correct phph syntax to add an image in wp functions.php

as i am a newb here, please help me to get this solved. i am trying to add a function in wordprress functions.php where i am trying to display an image relevant to my theme folder here is my code ...
0
votes
1answer
92 views

How can I remove page titles without removing the link in the navigation bar in twentyeleven?

I 'd like to remove the titles from every page in my blog. But the title in de navigation balk must stay of course. Any idea? Please explain as easy as possible :-) cause I 'm taking my first steps ...
6
votes
2answers
4k views

How to change default position of WP meta boxes?

Im wondering if there is a way to change the default position of Wordpresses meta boxes such as "featured image" for custom post types without having to drag them manually? Example:
1
vote
3answers
2k views

Remove “You are using Wordpress 3.2.1” from Right Now Dashboard Widget

I'm looking for a to hide the text on the dashboard that says "You are using WordPress 3.2.1" in the Right Now widget. Not that we don't love WordPress, but for our use-case (where we'll be providing ...
1
vote
0answers
58 views

Problem Keeping Permalink Structure [closed]

I have just set up my WP blog on heroku and have one minor problem. I have set the permalink structure in Settings to be postname (/%postname%/). Whenever I come back to the blog after a while I get ...
-1
votes
1answer
492 views

Adminimize Plugin — Is there an alternative to limiting Editor to 'Appearance > Widgets' only?

Adminimize > Menu Options: I want to grant access to "Appearance > Widgets" only to select users (but not Themes, Editor, Add New Themes; nor Plugins, Settings). Although I have selected this in the ...
1
vote
2answers
261 views

Is using eval() ok in this scenario

I am trying to include user input includes using "get_template_part()" The includes are added in the theme options eg a user inputs. get_template_part('content/block', 'branding'); ...
5
votes
1answer
828 views

how to group custom post types

hi wanted to know do i group my custom post types to appear together in a group in the wordpress back end menu bar like this below in the picture what code do i have to use in my functions.php so that ...
2
votes
2answers
769 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
186 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 ...
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
354 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
238 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
58 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
415 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 ...
1
vote
0answers
117 views

include a post unrendered into a post, then render the whole thing [closed]

With a few extra lines in my functions.php I've created a shortcode that lets me include the content of a post: function include_content( $atts ) { $id = (int) $atts['id']; if ( ! $post = ...
5
votes
5answers
901 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
167 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
51 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 ...
0
votes
1answer
170 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
183 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')){ ...
9
votes
1answer
2k 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
669 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 ...
1
vote
1answer
662 views

Slugs as breadcrumbs for Pages

I´m trying to create a function that creates a breadcrumb trail of Page slugs outside of The Loop. These breadcrumbs show the path from the homepage to the current (sub)page. For example, on the ...
1
vote
1answer
2k 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
94 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
220 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
326 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
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 ...
1
vote
1answer
98 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
274 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> ...
1
vote
1answer
1k 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
749 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, ...
2
votes
2answers
945 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. ...