Tagged Questions

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
767 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 ...
2
votes
1answer
1k views

Why is my custom meta box input not saving

I've added the following function to functions.php to add a custom meta box enabling the end user to input a gallery shortcode. I then intend to use this to place a gallery in a specific place on the ...
2
votes
2answers
889 views

Add class to Categories Widget

I have a few default widgets which I am using in a custom sidebar and I'd like to edit its output in my functions.php file. Currently the categories widget and blogrolls are generating an unordered ...
0
votes
2answers
1k views

Make Current/Active Page Number a Link (WP_LINK_PAGES)

With the default wp_link_pages the current/active page number is not a link. I would like to find a code/hack which turns the current/active page into a link to the top of the page. I am already ...
0
votes
1answer
304 views

Add title & subtitle to shortcodes

Is there a way I can add a custom title & subtitle to this shortcode function? function spoiler( $atts, $content = null ) { return '<div class="moreinfo"> <h3 class="click drop ...
3
votes
2answers
223 views

Override default cropping in Wordpress [duplicate]

Possible Duplicate: How can I make add_image_size() crop from the top? Is there any way to have cropping happen from the center point in an image? All of my Featured Image uploads are ...
0
votes
1answer
184 views

Tags break custom Excerpt function

Quick question here. I have a function that echoes out the post-type's content (if none available, the excerpt). It looks like this: function era_excerpt($post, $length = 11, $ext = ' ..') { ...
1
vote
1answer
79 views

Publish/Update post is changing image links from file url to post url

I've written a filter to wrap images included in posts with figure tags and their captions with figcaption tags. I turned off the visual editor so that it doesn't strip out all the html from the ...
0
votes
1answer
426 views

update_user_option not working as expected

So I was looking into the update_user_option() as I need to update an additional field upon registration. So I found this in wp-login.php: update_user_option( $user_id, 'default_password_nag', true, ...
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 ...
0
votes
1answer
432 views

Auto create Nextgen Gallery on post creation

I was wondering if there is a way to create a nextgen gallery with a function, so that I can hook that into my front end post creation setup. The gallery could be completely empty or be created with ...
0
votes
1answer
81 views

Post variables not displaying correctly in custom function

There seems to be something wrong with the simple function below, but I can't figure out what it is. It is displaying as the following and I can't figure out why. I know it has something to do with ...
0
votes
1answer
1k views

Custom Post Type & Custom Menu Walker to append custom class for active post types

I have an interesting problem I am trying to solve here regarding a custom nav menu. Essentially, I have created a custom walker class for my nav menu and I have manually added a menu entry directing ...
0
votes
1answer
524 views

Is it possible to display a DIV to not logged in users and then change it for users who are logged in?

Basically I'm putting together a magazine site that wants a strong focal point on the homepage for users who haven't signed up, if the user is logged in we need this content to show something else, is ...
0
votes
1answer
328 views

Multiple, Dynamic, Sidebars Problem - First Sidebar not working properly

This is my function: function ec_register_sidebars() { register_sidebars( 3, array( 'name' => 'Sidebar %d', 'id' => "sidebar-$i", 'before_widget' => '<li id="%1$s" ...
3
votes
2answers
4k views

Get user id from email?

I'm working on an email system, and I'm onto the unsubscribing stage. Since most of my users would not know their user ID, I'm asking them to put their email into a text box (definitely preferred, ...
3
votes
2answers
3k views

wp_register_script not loading as expected

I am loading scripts like this: //load scripts //wp_register_script( $handle, $src, $deps, $ver, $in_footer ); add_action('wp_enqueue_scripts', 'load_scripts'); function load_scripts() { if ...
0
votes
1answer
82 views

Run a function when post is deleted?

Is it possible to run a function every time a post is deleted. The function has to be run when the post is deleted from the admin or by the wp_delete_post() function.
1
vote
1answer
49 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
206 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 ...
0
votes
1answer
89 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 ...
0
votes
2answers
110 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
193 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( ...
1
vote
0answers
152 views

Save modified Custom Field content into another Custom Field on article save [closed]

In my articles I allow editors to enter a date in a human readable dd.mm.yyyy format into a custom field. But I also need this date as unix timestamp in the DB. So I wrote a function which takes the ...
1
vote
2answers
686 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?
-1
votes
1answer
67 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( ...
4
votes
1answer
2k views

Using functions from a plugin in your theme

I am a beginner to wordpress (and to php for that matter). I am trying to understand some of the basics, and building a little e-commerce store using a plugin called "Jigoshop." I'm reading through ...
8
votes
1answer
3k views

Solution to render Shortcodes in Admin Editor

I have asked this question about a year ago and I am hoping there is some type of simple solution which will allow me achieve my objective. So here it goes: I often utilize shortcodes within the ...
-1
votes
1answer
416 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.) ...
0
votes
2answers
695 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() { ...
2
votes
5answers
519 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 ...
0
votes
1answer
84 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
207 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
898 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
713 views

Remove category from url

I want to remove /category/ base from the permalinks. I tried the solution ...
1
vote
1answer
469 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
209 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
181 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 ...
0
votes
2answers
108 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
85 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
736 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 ...
0
votes
1answer
813 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
2k views

How to add a shortcode to call a function

I'm using Cimy User Extra Fields to add more registration fields. I'm also using Contact Form 7 Dynamic Text Extension to pre-populate contact form fields. I've read, in order to be able to use Cimy ...
2
votes
1answer
114 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 ...
0
votes
1answer
394 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
votes
1answer
179 views

which table updated after logout?

I am working on wordpress in which on clicking logout button user will be logout using <?php wp_logout(); ?> function when I followed some guidelines on wordpress site I came to know that it ...
-3
votes
1answer
1k views

Missing argument 2

Hi just looking for help with this cant solve this Thanks Missing argument 2 for t2t_homepage_slide()XXXXXXX/index.php on line 41 and defined in/xxxxxxx/ten.php on line 94 <?php ...
0
votes
2answers
410 views

Get fields from metabox array

In my functions I'm registering multiple metaboxes with custom fields. A single metabox array for instance, looks like this: In functions.php $meta_boxes[] = array( 'id' => 'general_info', ...
1
vote
1answer
77 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 ...