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)

-1
votes
1answer
6 views

Import a gallery and edit it in admin page?

I want to the import/copy a exact gallery on http://www.skidstahus.se/vara-hus/ to my page and make it editable in the admin page, so I could add new pictures and info. With the gallery I want to ...
0
votes
1answer
10 views

WordPress styling recent post

Trying to replicate the theme shown here http://i.imgur.com/k60YtiX.png. As you can see on the screenshot the first post is black and the second post is a grey colour. My progress so far is just at ...
0
votes
1answer
18 views

WordPress rating by views

I am trying to create a system much like the one on this website. http://i.imgur.com/0trw2c3.png What happens is, if the post has over 1,000 views it gives it a nice little icon above the featured ...
0
votes
0answers
7 views

Questionnaire That Returns Product Selection

I'm looking to implement a questionnaire based product selection for WooCommerce. The ultimate goal is for the consumer to be presented with a selection of products based on the results. Does anyone ...
0
votes
1answer
10 views

Registration form not registering First and Last name

I'm creating a custom registration form which works using username and email inputs, but when I include First and Last name fields it won't let me register. Here is the form: <form ...
1
vote
1answer
12 views

Add before_content and after_content to register_sidebar

Is there any way to add two new functions, before_content and after_content to the register_sidebar function? These would work like before_title and after_title, except it would wrap everything that ...
0
votes
1answer
17 views

Custom Behavior when Adding New Custom Post Type in Dashboard

I have a Custom Post Type that I'm doing some custom work for. I want to attach some custom functionality to the post type once it's created but an admin can only trigger the custom action from the ...
0
votes
1answer
10 views

Where do I store custom functions that call custom page template files?

I've created a Wordpress Page template called head.php I then went into /wp-includes/general-template.php and by replicating the default get_header() function that is already there I added this new ...
0
votes
1answer
13 views

WP_Query function for custom post type

I've got a CPT for random homepage banner images (so we can test different images and call to action language). I've got a custom field for the post type that accepts a specific ID for each banner so ...
0
votes
1answer
14 views

Showing user profile data on front-end

I'm making a profile-page so my members can update they're details trough the front-end. The problem is that the select-box named "Province" won't show the correct data when the page loads. How can i ...
0
votes
0answers
16 views

Can a single.php file be coded to allow HTML download from a button?

I have been searching on WP and on SO for a way to code a custom-single.php to allow the HTML code in that document to be downloaded from a button on the rendered site. What I have done is created ...
0
votes
1answer
13 views

Removing get_template_part in child theme

Parent Theme loads some template files in its functions.php as follows: get_template_part ('lib/login/register.php'); I want to remove this file in child theme and include my custom php templates. ...
0
votes
1answer
17 views

Function to replace comment's accented characters before posting

I have some weird problems with encoding my Wordpress website and I can't add comments with accent words. when i try to do it, i received error by WP. What i need is just a function that read the ...
0
votes
0answers
7 views

Why does wp_insert_post take longer than media_handle_upload?

I've got a page on my Wordpress site where users can submit posts or documents through the front end. I use wp_insert_post for the posts, and media_handle_upload for documents. wp_insert_post takes ...
0
votes
1answer
17 views

Exclude Custom Post Type & Pages From Auto-Tag Function

I am happily using this bit of code to auto-tag posts by author (thank you again cybmeta): add_action( 'save_post', 'add_authors_name'); function add_authors_name( $post_id ) { $post = get_post( ...
0
votes
0answers
23 views

site_url() returns with additional backslashes

I am using site_url() function and it returns the address as http:\/\/vip.local\/cc where I can see that WP automatically adds unnecessary backslashes. Is this for some escaping purpose? I tried using ...
0
votes
1answer
18 views

wp_nav_menu work in functions.php but not in the theme

I use wp_nav_menu with this code in functions.php: register_nav_menus( array( 'sidebar_menu' => 'Sidebar menu', 'topmenu' => 'topmenu', ) ); $args = array( 'theme_location' => ...
0
votes
0answers
21 views

Add_filter to Gravity forms: How? [on hold]

So, there is a function in Gravity forms that automatically skips the classname of every 10th checkbox, as a hack so that 5.1 doesn't conflict with 5.10 (according to common.php). I want to change ...
0
votes
0answers
14 views

How can I detect if user has subscribed Memberpress product already

How can I detect if user has already bought a memberpress product. I'm searching something like this: if(have_subscription){ //code to add button }else{ // code to add something else } I have no ...
0
votes
1answer
35 views

If WooCommerce Stock Updates, Also Update Specified Field Values

I would like to have a function that should update the Est. Dispatch Date Field ) in whenever WooCommerce Stock Value / Stock Amount changes even when order is placed and stock amount is reduced by ...
-1
votes
0answers
25 views

Child Theme is available, but live preview only returns a blank screen [closed]

I can see the child theme in admin, but when I click Live Preview it tries to load but only displays a blank screen. The parent theme loads fine doing a Live Preview. I have to assume it is the ...
0
votes
0answers
12 views

How to add custom redirect via parse request [on hold]

I want to add custom redirect: Please tell one liner code to do : 301 redirect, 307 redirect, meta, javascript; add_action('parse_request', 'my_custom_url_handler'); function ...
0
votes
1answer
24 views

How to register a menu based on a ACF condition

I am trying to register a Wordpress menu, depending on a ACF field condition. $logo = get_field('logo','options'); if ($logo) { register_nav_menus(array( 'brand_centered_left' => __('Brand ...
1
vote
1answer
20 views

Add get_option to jquery

I have created a settings page that contains various radio button options for a custom plugin. A radio button I've created is to 'display dots' with the values yes or no. I can get use the value any ...
-3
votes
0answers
24 views

WooCommerce - How can I hook into product variation select to show dynamic content for each variation? [closed]

my site runs Wordpress + WooCommerce and I have put together a simple plugin which I am using in my sidebar to run the standard [product_category category=""] shortcode, with get_post_meta to retrieve ...
0
votes
0answers
27 views

How can I add recent posts to menu like mashable

I would like create a mega menu that uses recent posts for hover state. Like When you hover a submenu you get a list of recent post relevant to that menu item like in Mashable. I I would like a menu ...
0
votes
1answer
46 views

What is wrong with functions.php? Fills error log with same error

After a third-party developer was used to reconnect our calendar with the Google Calendar API 3, we found that our .../wp_admin/error_log infinitely wrote: [14-Apr-2015 11:46:59 America/New_York] ...
8
votes
5answers
239 views

Best way of passing PHP variable between partials?

I have a variable in header.php, such as: $page_extra_title = get_post_meta($this_page->ID, "_theme_extra_title", true); Once I do: var_dump($page_extra_title); I always get NULL outside of ...
0
votes
0answers
7 views

Detach “Add to Button” from amount specifier [closed]

Hello I'm having trouble with my "ADD TO CART" button positioning on my wordpress page. As you can see from the picture below the button is placed under the amount specifier. I have tried using ...
0
votes
1answer
21 views

Function returning queried meta value based on current post ID

I have written several queries which sums download counts grouped by the post they are associated with, and other relations. They work great for exporting to CSV and other uses outside of WordPress, ...
0
votes
1answer
35 views

Wordpress get_post_meta issue

I'm new to php and was assigned some code to fix within a Wordpress theme, but I cannot figure it out for anything. The code is for the home page of a custom theme and it is supposed to pull the most ...
0
votes
2answers
25 views

Generating dynamic css into custom file [closed]

This is about running code on wordpress . The given code runs properly outside wordpress but when I put it on theme functions file it does not do anything. ob_start(); require('dynamic-css.php'); ...
0
votes
1answer
38 views

Woocommerce Price Text

I'm trying to show after the price of my product, whether the price is 'per person' or 'per group'. I've created a custom field for both, so for example, if custom field 'price_per_person' is ticked, ...
0
votes
1answer
30 views

Conditional read more adjustment

I get the read more link like this <?php the_content("Read More"); ?> I want on the Homepage a different text than on an archive pages. I can change the text for all read more links in ...
0
votes
1answer
27 views

How to fix blank pagination links?

I am working on a Wordpress blog that has what appears to be custom pagination for the posts. As you can see here the correct amount of links are being rendered at the bottom of the page, however ...
0
votes
1answer
14 views

get_template_directory() - references parent theme directory

I've got this line in the functions.php of my Child theme: require ( get_template_directory() . '/somecode.php' ); However it's giving me the following error: Fatal error: require(): Failed ...
1
vote
1answer
122 views

Understanding and altering the structure of posted images

Currently this is the (default) Wordpress image output: Float left, with caption, link to img <figure id="attachment_10220" style="width: 167px;" class="wp-caption alignleft"> <a ...
0
votes
0answers
44 views

AJAX login without a plugin does not work. when add a action to function.php

I am using wordpress ajax login without a plugin. I want to not be allowed users access to the WordPress profile after login, Because i have designed a specific profile in the link: ...
0
votes
1answer
13 views

Writing editor content to a file

I have a project I'm working on where I need to write the content of the post editor to a physical file on the web server when a post is saved or updated. I'll be parsing and manipulating the content ...
0
votes
0answers
6 views

How to fix the warning shortcode function generated by Theme Check? [duplicate]

I searched on the internet but I still don't know how to fix it. I solved most of the the errors in WordPress Theme I am developing except for one WARNING. Please refer on complete error lines below: ...
0
votes
0answers
23 views

Create csv file in plugin

I have written a function to create csv file usin the below code.I am getting Headers already sent warning and I can't able to create the csv file too.How can I fix this problem.I have attached the ...
0
votes
0answers
8 views

Running wp_schedule_single_event on Post Import

I'm trying to have a category deleted after a certain length of time once a post has been published. I was successful in doing this when a post is manually created, but I cannot for the life of me ...
0
votes
0answers
18 views

Getting current user option within a function

I have created a new true/false field for specific user role "Member" to receive email notifications if a new post is published. For reference I'm using advanced custom fields to create a true/false ...
0
votes
1answer
29 views

Featured Image field not appearing in Custom post type

I created CPT called "Basics", then added the following code to functions.php add_theme_support('post-thumbnails'); add_image_size('large_thumb', 900, 500, true); add_image_size('small_thumb', ...
0
votes
2answers
36 views

Adding and updating repeating custom field meta data

I've got 20+ hours into this and could really use some help. Here is what I am trying to do.. For each record, add post meta. If the post meta already exists, update each field in the array. Just like ...
0
votes
1answer
30 views

widgets not working

I pasted my siderbar widget code in widgets.php file function right_sidebar_widget() { register_sidebar( array( 'name' => 'Right Siderbar', 'id' => 'right-siderbar', ...
-1
votes
1answer
20 views

trouble with passing class method data to outside function

I'm attempting to call a function using this shortcode format: [priceguide file='test.csv' type='mods'] When I do this, all I get back on the page is the file name, test.csv, and nothing else. ...
0
votes
1answer
26 views

List all post title in category using functions.php

I have search all google about this. But many of theme show the way to make a new Template Page which you can choose template type for page. But i want it directly show post title in category by ...
0
votes
0answers
30 views

Dynamically changing menu item link

Hoping someone can help me out - this has been driving me nuts for the past two hours. I'm trying to create a menu item - the menu URL should basically be: http://thesite.com/author/%username% ...
0
votes
2answers
30 views

wp_enqueue_script only works outside of action

So i've been trying to figure this out for awhile now. The following code does not seem to work for me. The javascript file will not be included in the footer ( or anywhere for that matter ) function ...