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

Setting post_id for single.php based on URL without a redirect

I'm migrating a Joomla! database to Wordpress and the website has to remain exact regarding URLs. The Joomla site has its posts with .html extensions, and the importer I created maps the Joomla file ...
-1
votes
1answer
511 views

wordpress Search function is not working

My wordpress Website Version is 2.8.1,This is the Custom wordpress website done by 2 years ago.[Link Removed... i got Solution][1]Now Search functionality is not working(It was working well earlier.) ...
1
vote
1answer
53 views

Include default functions and methods

I'm starting a new service for a customer consisting in adding a input API in their WP website. I started by creating a blank page on the root but then I realized I couldn't access all methods and ...
0
votes
1answer
90 views

loading custom.js file after jquery is loaded

I am adding a javascript file through the functions.php file. I am using the method as suggested on Wordpress Codex. One question I have is that what is the best way to handle the version number ...
2
votes
3answers
2k views

Creating a table from shortcode avoiding wpautop for each row

I'm probably doing this all wrong, and there'll be a much simpler solution. Basically, I'm trying to build a table of tour dates that'll be editable by someone with little technical knowledge, but can ...
0
votes
2answers
119 views

Functions.php Problem

When I add lines 3 - 19 to the top of functions.php, then try to update image.php I get the error "Warning: Cannot modify header information - headers already sent" when I try to update my image.php. ...
1
vote
0answers
35 views

Can i attach a post specific tag to a comment? [closed]

I would like to be able to have the comment "waiting for approval" mailings display the blog they came from. I.e, if a comment is left for approval from "eating fish" the mail message ought to ...
0
votes
2answers
204 views

adding custom script to functions file

I have a problem adding a custom script to my functions.php file: add_action('wp_print_scripts', 'load_AJAX_URL__'); function load_AJAX_URL__() { wp_localize_script( 'ajax_URL', 'MyAjax', array( ...
2
votes
5answers
670 views

Code in theme functions.php faster than with a plugin?

I've read many articles that says that we should not keep plugins that we don't use. Even if they are disabled, they use memory. functions.php instead of 10 plugins? What if i have 10 small plugins ...
1
vote
2answers
776 views

Display gallery on top before content

Is it possible to execute the gallery shortcode before any other content no matter where the shortcode is in the post HTML?
0
votes
4answers
3k views

Remove Page Title from Static Frontpage

I'd like to remove the post title from my static frontpage. Just that page. I've created a child theme from a free Press75 theme. So I'd like to make this change in my child theme's function.php. I ...
-1
votes
1answer
75 views

Removing title from page

Hello attempting to remove the title from static front page using the following code is (not working) in my functions.php function remove_page_title() { if (is_front_page() ) { add_filter( ...
0
votes
2answers
888 views

Echo custom field value in shortcode function

I must be doing something wrong here. I want to display the custom fields "pw_featured_note" & "pw_featured_price" Here is my code so far function featured() { ...
0
votes
1answer
91 views

A better way to get stats

I'm not looking for an specific answer but more of a general direction. Recently I decided to make my own stats plugin. I know there are tons out there, but I wanted to make my own. I figured, how ...
0
votes
2answers
247 views

Don't display html if function returns nothing

This question is very similar to the one below however it requires a different solution. Don't display html if custom field is empty I'm using the plugin Related Posts Thumbnails but i'm using ...
2
votes
3answers
1k views

How to add .htaccess code through a function?

I need to add the following .htaccess code through a function <IfModule mod_deflate.c> # Insert filters AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE text/html ...
1
vote
2answers
897 views

Remove category from url

I want to remove /category/ base from the permalinks. I tried the solution ...
0
votes
2answers
110 views

WordPress Comment functions

As we know we can usually make changes to "the content" by calling the_content(). is there any equivalent function available for comments? or any such way do you know?
1
vote
1answer
615 views

How to limit character length in BuddyPress function output [closed]

BuddyPress has a function (bp_member_profile_data) that pulls profile data into a members loop which looks like this: <?php bp_member_profile_data( 'field=Organization' ); bp_member_profile_data( ...
0
votes
2answers
235 views

Changing functions.php and .htaccess files

Can I mess up my Wordpress site if I change functions.php file for my custom theme? One time I added some code to it and it gave me some PHP errors and my site was inaccessible. Luckily it was in the ...
0
votes
1answer
209 views

Looking for Functions File that doesn't Exist

My WordPress site seems to be running fine, except that trying to go to the plugins page gives the following error: Fatal error: Cannot redeclare _verifyactivate_widgets() (previously declared in ...
1
vote
1answer
87 views

How does Wordpress insert Paragraphs in posts

So when looking at the html-view in the editor there is no <p> tags, when a view the post every line break is surrounded with a <p>. How?
0
votes
1answer
994 views

hook for dashboard show_user_profile

I'm looking a way to avoid regular users go to profile and dashboard page. Have this little code to work with profile page: function lockdown_profile() { global $current_user; return ...
1
vote
1answer
3k views

Function to return true if current page has child pages

I'm trying to create a simple function to do a "status test". Goal is to test and see if the current page being viewed has any child pages or not. Using this to alter layout to accomodate child ...
0
votes
1answer
731 views

How can I call a PHP function inside a hardcoded shortcode?

Maybe I'm doing this the long way but I need to make something like this: <?php echo do_shortcode('[mu-events months="11" startmonth="today" orderby="time" orderas="ASC" sites="?> <?php ...
1
vote
1answer
78 views

Wordpress Access allowed to fewer pages till user logs in

Is it possible in wordpress,by editing theme functions.php, to stop user access for all pages except Home, about-us, contact-us until a user is logged in to the system? All buddypress and wordpress ...
2
votes
1answer
117 views

More than one meta field in a single meta box?

I'm following this tutorial by Justin Tadlock on creating meta boxes. http://wp.smashingmagazine.com/2011/10/04/create-custom-post-meta-boxes-wordpress/ I can get a meta box with a single field to ...
7
votes
3answers
681 views

Order posts (across the whole site) by metadata date

My custom 'Home' page is set to sort my custom posts via the custom date field with this (updated to be custom named) code in functions.php: // sort order for home page add_action('wp', ...
0
votes
1answer
949 views

Uses for function: wp_update_user

my theme currently uses the wp_update_user function to update a set of user metas. I created to some new user meta fields that I would like to include in the existing wp_update_user. The function ...
0
votes
2answers
579 views

Echoing function into Wordpress NextGen gallery

Is there anyway to echo a function into a wordpress shortcode? heres my code: <div id="subscription"> <?php echo do_shortcode('[nggallery id=$ID]');?> </div> $ID is a function ...
0
votes
1answer
132 views

Why does this fail: Disabling plugins enqueue_script() in functions.php

I'm trying to use the method presented here: Restricting a Plugin to Only Load its CSS and JS on Selected Pages? In the plugin 'syntax-highlighter-compress' I've got the following code: function ...
1
vote
2answers
1k views

Theme Options: If There is No Input, Don't Display?

I have built a custom options panel which allows site owners to enter their social profiles. I then use the second code to make the links appear in the theme. When no link is entered in the options ...
0
votes
1answer
119 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 ...
3
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
676 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
120 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
312 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
256 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
104 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
220 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
213 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
83 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
77 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
797 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
418 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
421 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
202 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
100 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 ...
9
votes
2answers
8k 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
3k 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 ...