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

Issues with add_query_arg() not passing a variable

Im trying to pass a variable($homezip) to the URL on a new page using add_query_arg() but its not working for variables radius works fine. $homezip = $_POST["search"]; $stringzip = esc_url( ...
0
votes
1answer
32 views

Show only top 3 posts from 3 categories in order on home page

This function will show the last 3 posts from any category on front page: // Only top 3 posts from CHR category add_action('pre_get_posts', 'ad_filter_categories'); function ...
0
votes
0answers
13 views

Redirect to “pre-page”

I am using the Events Manager plugin to create bookings. The site currently functions like this: Page 1: Lists all events (clicking on an event takes user to booking page - Page 2) Page 2: ...
0
votes
0answers
17 views

Content Section Custom Anchor Not Working

I purchase WP theme (Techwise) and I found an issue with content menu sidebar in post page. that content not working as same (toc) Table of Content. it's not working with Arabic letters but working ...
1
vote
0answers
35 views

Pagination in relation to archive.php

A small problem here, I just don't know how to change this because I'm a self taught newbie. I made a child-theme from the simone-theme with a static front-page. To it I have the archive.php as the ...
0
votes
1answer
21 views

update_post_meta not working in function

I am attempting to take some custom field meta data (generated via the ACF plugin) and save it as post meta with a function. This is what I've come up with: function tps_create_slotcode($post_id) { ...
-1
votes
0answers
18 views

Address to Coordinates [closed]

I just started using WordPress. I am creating a registration form using Pie register but I would like to add a feature. When the person who registers, I want his/her address to be converted into ...
0
votes
0answers
14 views

Custom post type archive not displaying after site move from sub-directory

I have just moved a site from a sub-directory to the root of a domain. The move went reasonably well but I came up with two issues that have stumped me. The first which I have resolved was that one ...
0
votes
0answers
17 views

Functions.php in Child Theme error issues

I have been trying to update my functions.php file in my child theme and find this code in the file downloaded from the host. add_filter('https_ssl_verify', '__return_false'); ...
0
votes
0answers
14 views

Custom Taxonomy as Link

I have this image here http://i.imgur.com/5szTQNy.png which shows the download button I will be talking about. I am trying to make it so that when I put in a custom taxonomy box in the back end the ...
0
votes
1answer
20 views

How to get_template_directory() properly on local environment

I'm currently developing a site locally in MAMP PRO. When I use get_template_directory() inside of the standard functions.php file, the site path gets output correctly. However, I have a separate ...
0
votes
2answers
30 views

Custom function causes a 503 error after a couple of hours

I have a custom function written in PHP for a Wordspress theme. When I initially wrote it, it worked exactly as expected (it returns the parents and grandparents etc of a term from its ID). However, ...
2
votes
2answers
27 views

wp_link_pages: display current page number only if has multiple page breaks?

I'm trying to build a function to display the current chapter (page) within the single.php file ONLY if there's more than one chapter (page break). This function will output the chapter # within the ...
0
votes
0answers
13 views

Fetch external call on specific URL

Is there a built in function which - if not how do I accomplish - can map all incoming calls on a specific URL e.g. http://www.example.com/incoming/RANDOMSTRING to a function in WordPress? SOLVED: ...
0
votes
0answers
18 views

How do I sort woocommerce grouped products by post date instead of menu order? [closed]

What code/filter can I add to my wordpress functions.php file to modify the order of grouped products by post date instead of menu_order? class-wc-product-grouped.php $args = ...
0
votes
0answers
26 views

New WP_Query calls Pre_get_posts filter twice

On my WP theme template page, I am running a new WP_Query. It seems to be calling my pre_get_posts filter twice, which then wrecks my custom parameters. The second time the pre_get_posts filter is ...
0
votes
0answers
14 views

WordPress permanently logging users out

I am using WordPress as a solution for digital signage on large displays and on personal computers in a company. In this use case the WordPress installation is a closed system which needs a login to ...
0
votes
2answers
17 views

How to add the post ID (or any other post data) to a Contact Form 7 mail?

I've downloaded Contact Form 7 to add contact forms adding a simple snippet after every post, and I've added it in functions.php like this : //if post type I add a form function is_post_type($type) ...
0
votes
3answers
41 views

Include Jquery libraries in wordpress theme?

I have a file in my theme's JS folder named cycle2.js. How do I include the Jquery from 'wordpress→includes' into my theme? How do I load this custom JavaScript file 'cycle2.js' into my theme? I ...
0
votes
1answer
17 views

Change meta tags programatically

Is there a way to change the meta tags not in the head but in a template file through code? I would like to change the meta tags <meta property="og:title" content="title" /> <meta ...
0
votes
2answers
105 views

Create a post builder skin in a plugin

Currently I'm working on a plugin that will display a grid based on post type with many settings to customize it. One of the settings will be to choose between different skins available to display ...
0
votes
1answer
20 views

Code to display category-specific single.php is overriding normal single.php, too

I have two different post type categories on the site I'm building at the moment - "press" and "blog". I used the following code, inserted in my child theme's functions.php file, to get the "press" ...
0
votes
1answer
40 views

What add_action reference should I be using or should I use do_action?

I am working on some automated emails. I am fairly new to add_action and do_action. I am having a tough time understanding it. The site in question has number goals set up that people reach over ...
0
votes
0answers
10 views

Disable iframe in wordpress catch_that_image

I want to ask how to fix catch_that_image in wordpress ? I'm using code in wp-content/themes/name/functions.php function catch_that_image() { global $post, $posts; $first_img = ''; ob_start(); ...
0
votes
0answers
5 views

Using Xeditable with Bootstrap my post.php function says 404 Notfound but executes the db update?

I am using the Xeditable library with Bootstrap 3. I have everything setup to work... and technically it is working.. except that when I submit the value via the popover the network response is a 404 ...
-1
votes
1answer
26 views

Import a gallery and edit it in admin page? [closed]

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
16 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
21 views

WordPress rating by views [closed]

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

Questionnaire That Returns Product Selection [on hold]

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
15 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
19 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
19 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
14 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
19 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
17 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
19 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
15 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
27 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
19 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
19 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
15 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
42 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 ...
0
votes
1answer
26 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
21 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 ...
0
votes
0answers
29 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
48 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] ...
9
votes
5answers
282 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
1answer
23 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, ...