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

Using add_filter() in Widgets

Just have a query reference the add_filter() function. Can you use this function inside a WordPress widget class. Example I have a widget with dynamic created code that I want to pass to another ...
0
votes
1answer
22 views

Shortcoding with Divs

I am trying to turn a custom query into a shortcode but I am having some difficulty. Firstly, I am not sure how to return a custom thumbnail size via $return_string...in fact I am not sure how to ...
0
votes
1answer
33 views

date function not correctly returning date

This code is being used to generate the date of a post in wordpress: <span class="the_date">Posted: <?php echo get_the_time('F d, Y'); ?></span> However it is not resutning the ...
0
votes
1answer
82 views

Fatal error: Call to undefined function the_ratings_results()

I was wondering if I rack your brains a bit on this one. I have a custom theme that has files in the theme folder but do not load as wp template files on the page settings. I also run EDD (easy ...
0
votes
1answer
89 views

How to use WP_rewrite?

I need to add the following rewrite commend to WordPress .htaccess file: RewriteRule ^read/([0-9]+)/?$ /read/?u=$1 [QSA,L] How to do this by a function? i.e., how to do it by use wp_rewrite in ...
0
votes
1answer
30 views

Wp get archive only text not link

i use this function wp_get_archives( array( 'type' => 'yearly', 'limit' => 12, 'format' => 'html' ) ); And i got this: <a title="2013" ...
0
votes
1answer
31 views

Adding pagination to custom Wordpress function

I am trying to add pagination to posts however i cannot figure out how to get it to work - it simply does not show the pagination as i need it to. It should display the first 15 posts on the first ...
0
votes
1answer
106 views

Delete pages and Create default pages for all new network sites

I am using the following code to delete some default pages and to also create some default pages for all new sites that are created. It work as is now but that is only because I purposely have a ...
0
votes
1answer
74 views

Metabox Input Not saving

I haven't made any meta-box's in quite some time so quickly threw together this one for a website I'm developing. My problem is that when I input some text in the box's and hit save the text ...
0
votes
1answer
83 views

I want to split this into two functions

This code i will add below is for Custom Fields for Custom Post Type and GMap for Custom Post Type. Currently both are pulled by this function. I want to seperate both. One for Custom Fields and One ...
0
votes
1answer
141 views

Can't change excerpt length and more tag

I tried to change the excerpt length and the more tag the way it is described in the codex: function custom_excerpt_length( $length ) { return 10; } add_filter( 'excerpt_length', ...
0
votes
1answer
63 views

Create dropdown of users in admin dashboard

I'm trying to make a list of users come up in a widget in the admin dashboard. So far i've got it showing up, but I want the list to show a custom field from the user's profile instead of the normal ...
0
votes
1answer
209 views

WC Cart Edit Public Function

How would you go about making an edit to the following public function in your child theme? For instance, I would like to comment out the 'if statement' in the WooCommerce WC_Cart class function that ...
0
votes
1answer
181 views

Call to undefined add_action() in theme's functions.php

Once done validating a form with ajax, I use php within my functions.php to actually send the form. <?php $name = $_POST['fname']; $lname = $_POST['lname']; $subject_line = $_POST['subject']; ...
0
votes
1answer
106 views

Highlight main menu when on specific posts or pages

I am using Genesis and have written a custom function which works fine, but is very ugly and includes a css statement. The object is to highlight a menu link in the main header menu when on certain ...
0
votes
1answer
139 views

Getting images from media library and get_the_date() not working

I've got a function to display all images in the media library on a page. I would like to display the date of each image, but using get_the_date() only returns today's date. Here is the code I'm ...
0
votes
1answer
49 views

Additional Sidebar

Hi I wanted to create extra sidebar in my theme and I am not sure if what I did is correct. In my theme functions.php I found this function: function blankslate_widgets_init() { ...
0
votes
1answer
179 views

display last post modified date in genesis child themes

Since I frequently update posts so it’s crucial for me to display last modified date instead of post published date like following image. Its because I want search engine to display my post last ...
0
votes
1answer
346 views

Only let plugin add actions to wp_head & wp_footer on single posts

I'm using a a plugin (Comments Evolved) on a recently built site. The issue I'm having is that this plugin globally enqueueing and adding actions to the head and footer of all pages. I'd like to ...
0
votes
1answer
82 views

How do I change the URL returned by next_posts_link()?

I am integrating a WordPress blog into my existing portfolio, test.mysite.com. The WordPress default twenty twelve blog appears on test.mysite.com/blog/. I want to integrate WordPress functionality ...
0
votes
1answer
26 views

get_the_title in edit post_link

Basically I would like to link to the edit post interface in Wordpress with the string to display being the post title. Cannot get it to work have tried any syntax that I could come up with, but I am ...
0
votes
1answer
43 views

Disable plugin function

I want to hide most of the backend links added by TinyMCE Templates plugin. I have problem with 'Copy to a new template' link inside Publish box. Plugin code: add_action('post_submitbox_start', ...
0
votes
1answer
134 views

Function to wrap the_content in a div

Whenever I've developing a new theme I always wrap the_content in a div, like so; <div class="entry-content"> <?php the_content();?> </div> Is there a way I can streamline ...
0
votes
1answer
28 views

Display post x of y within category

I'm currently using this class in my single blog posts to get a total post count and number my posts (post 89 of 90, etc...) class MY_Post_Numbers { private $count = 0; private $posts = array(); ...
0
votes
1answer
78 views

Call a function with href

Is there any way to call a function inside plugin with <a href='plugin-function'> tag? I need this to show user details which will not be bound to any action hook.
0
votes
1answer
29 views

More link - not text

I am using origin theme. This theme writes dots in post end. In functions.php file I saw line with text: function origin_excerpt_more( $more ) { return '...'; I changed text to More... and ...
0
votes
1answer
407 views

Load post attached images on a single page site with fancybox

I'm trying to make a single page site that will display posts as thumbnails in some part. Then if a thumbnail is clicked, I want all the images contained in this post to be loaded with fancybox while ...
0
votes
1answer
57 views

resizing of thumbnails not working

i have the following in my functions file from the wordpress codex <?php add_filter('show_admin_bar', '__return_false'); if ( function_exists( 'add_theme_support' ) ) { add_theme_support( ...
0
votes
1answer
165 views

How Do I include/Import a Custom Widget from the Parent theme into My Child Theme?

I'm trying to make a small modification to a custom widget that was included with a clients parent theme. Whenever I remove the parents version of the widget (for testing purposes) the child version ...
0
votes
1answer
58 views

Wordpress Theme Update Action?

I've done quite a bit of searching. I'm looking for hook/action called after a theme update. I know the initialization one - but a basic update? Cannot seem to find. If one does not exist, how can ...
0
votes
1answer
39 views

Adding Categories Through Function

I am creating a template theme for WP and am wondering if there is a way of the theme adding new categories to the db, through the functions.php upon activation of the theme. It seems like a fairly ...
0
votes
1answer
161 views

One button to change all settings in theme customizer?

I have been attempting to create a theme reset button for the theme customizer that automatically removes all of the theme_mod settings. I have tried multiple ways to do this and have never been able ...
0
votes
1answer
88 views

Showing custom post type categories in the menu

here is my custom post type and category: //Register nav register_nav_menus( array( 'main_nav' => 'Main navigation' ) ); //Custom post types add_action( 'init', 'create_post_type' ); function ...
0
votes
1answer
274 views

How to autopopulate the Advanced Custom Fields from the submitted form data?

I use this code in the functions.php to autocreate a post after a form has been submitted: <?php add_action('iphorm_post_process_1', 'mytheme_create_wp_post', 10, 1); function ...
0
votes
1answer
31 views

Need a functions that adds (adm)/(mod) if current user is admin/moderator right after their username

When a moderator/admin leaves a comment I want them to stand out and not be like any other comment. I have this piece of code so far but I dont think will do any good <?php $current_user_is_a_mod ...
0
votes
1answer
104 views

How to change pagination base from slash to query form?

Can this function... function custom_pagination_base() { global $wp_rewrite; $wp_rewrite->pagination_base = 'p'; $wp_rewrite->flush_rules(); } add_action( 'init', 'custom_pagination_base' ); ...
0
votes
1answer
80 views

How can I create a menu items from meta box based on users input

I have created a metabox that takes a name that the user can give as an additional name of their post. I am wondering how I can automatically create a menu item based on the name the user input into ...
0
votes
1answer
260 views

Defining multiple categories for showing latest posts

I have a function that lets me display the latest posts on my website, however i want to function to show posts of multiple categories at not just one specific category. Check the code below and what ...
0
votes
1answer
109 views

Countdown to date function?

When a user signs up on my site they have to select a date as part of resignation. On their profile page I need to show a countdown to that date. Something simple like attached. How can I create this ...
0
votes
1answer
79 views

Generate daily archive whenever any post type is added

We have an issue with our date archive in WordPress, where our daily archive (example address www.xxx.com/2013/01/09) is only generated when a post from the default post type is added. Any day where a ...
0
votes
1answer
90 views

BuddyPress: Re-using plugin function inside of Members Loop

I've been studying the source of a plugin which calls the following function to display an image inside of a user's profile (BuddyPress). My aim is to call the exact same function to do the same thing ...
0
votes
1answer
566 views

Polylang: pll_e() & pll__() on functions.php, doesn't work

I've on functions.php some functions that echoes blocks of HTML. Problem comes with Polylang plugin, that uses custom functions pll_e() and pll__(). Those works right on index.php on every theme, but ...
0
votes
1answer
157 views

Adding a 'style=' bit to image_send_to_editor output

The best thing I liked about the new v3.5 media manager was being able to insert images to a post hosted by an external site like photobucket using "Insert from URL". I normally format my image ...
0
votes
1answer
329 views

Custom registration form in shortcode getting internal server error 500

I created a custom registration form which works fine when used as a custom page template. I needed it as a shortcode so I created a shortcode using the function below /* Custom shortcode */ function ...
0
votes
1answer
50 views

How to list posts that appear in two categories

I would like to list all posts that appear in the current category being viewed that are also posted to a second category. Example Pictures : LINK For instance, a listing of the common posts between ...
0
votes
1answer
90 views

Trying to output a “Most visited blogs” list in wordpress multisite

Does anyone know how to get a "most visited" list out of Wordpress Multisite? I got alot of bloggers and have been looking for a way to output a top 10/20 list of most visited blogs, but cant find ...
0
votes
1answer
86 views

Migrating site, only header shows

I have copied my file structure to a new server, and exported the relevant tables to an SQL file. I have imported the tables to the new database. When I visit the new URL, only the header of the ...
0
votes
1answer
240 views

Custom attributes to javascript tags

My site uses cloudflare but I really want to enable rocket loader, but if I put it on automatic mode, it messes up my whole site... So I googled and found This answer which has helped in terms of ...
0
votes
1answer
35 views

Access to wordpress method inside of classes

How could I access an usually word-press method as example $this->get_current_site(); inside of a class?
0
votes
1answer
133 views

Ajax call does not work for this custom code

I have this ajax call which gets the value for catname: jQuery('.bio a').click( function(){ var catname = $(this).closest(".bio").data('category'); alert(catname); jQuery.ajax({ ...