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

Different body image backgrounds on different pages, posts and categories

I am trying to implement the ability to choose a different body background image to different posts, pages and categories. I am using Advanced Custom Fields to add an image field to every post, page ...
0
votes
0answers
13 views

function to add radio inputs that set custom fee

I'd like to add a custom fee to orders, and have that custom fee be chosen by the customer. So, under the 'Add to Cart' button, there should be a few radio inputs with set dollar amounts. By ...
-3
votes
1answer
57 views

Error in theme check “ Found a translation function…”

I have used underscores to create a unique theme. I am getting theme errors (as identified by the WP Theme Check plugin) as follows: WARNING: Found a translation function that is missing a ...
0
votes
0answers
20 views

Override a __construct function in child theme

I'm trying to override a loop function in a child theme. I've tried a lot of things I found on google, but something fails, sometimes nothing change, sometimes I get a 500 error. This is the original ...
0
votes
1answer
58 views

How to append to title via functions.php for auto-posting plugin [duplicate]

What I've got so far I've finally got the functions.php plugin to append a string to custom post titles of a certain post type with this function: function append_album_review_to_title( $title ) { ...
0
votes
1answer
24 views

custom post type does not working when adding in child theme function

I'm trying to register post type through child theme function.php but it does not working. However its working fine when i adding in the parent functions.php. add_action( 'init', 'testimonial' ); if ...
0
votes
1answer
27 views

Call to undefined function error in plugin

I wrote a function inside a class that gets a user's country from the IP address... function getcountry() { if (!class_exists('GeoIP')) { include_once("geoip.inc"); } if ...
0
votes
1answer
26 views

Insert menu into theme location depending on user logged in/out status

I am using the Avada Theme from Themeforest and I have set up 2 menus under Appearances > Menu: menu-logged-in which contains a parent item (My Account) and then several child items; and ...
0
votes
0answers
17 views

How do I redefine wm_navigation() or wp_logo() within a theme that uses hooks?

What I want to do: Move the title of my website from it's current location to be in the "menu" div so that it is to the left of the menu/page list. Demo page: http://aaronmoore.me/visartsassignments/ ...
0
votes
0answers
53 views

How to get last order number in Woocommerce and insert next?

I am developing an offline product to retail. This will be sold by a distributor NOT through my website. I have an sequential order reference system based on woocommerce such as 152, 153 etc. I want ...
0
votes
2answers
33 views

It does not work concatenation in function.php

I want to put a variable between two tags, but it puts him out. This is my function: (function.php) /* traer thumb */ function item_thumb() { global $post; if (has_post_format('video')) { ...
0
votes
0answers
171 views

WooCommerce - Customer Order History Pagination

I'm trying to implement pagination into WC's customer order history that can be seen on the "My Account" page using woo_pagination(). https://docs.woothemes.com/document/woo_pagination/ The template ...
3
votes
1answer
54 views

Display more recent and less recent posts in same category

Is there a way to display not just the-most-recent posts in a category, but the 3 posts in a category more recent (time-wise) than the current post? For example, Jan10post Jan15post Jan17post | ...
0
votes
0answers
18 views

Add extra attributes to images via editor

Would like to allow editors to add: data-action="zoom" to image tag without them having to code it. Preferably from a TinyMCE button/menu. Example: <img class="alignnone wp-image-2438" ...
0
votes
1answer
67 views

How to replace native comment_count with Comments Evolved aggregate count

What I Am Trying To DO I am using a plugin called Comments Evolved which aggregates comments that are tabbed from Faceook, G+, and WordPress native. I am trying to replace the native comments_number ...
0
votes
1answer
39 views

How to list out all values from the get_body_class array

I am trying to list out all of the current page body classes. using the body_class function it gave me class="[body classes were here]" however I need to show these as plain text. I have tried the ...
0
votes
0answers
36 views

How can I make a function as sticky expired date post?

I want to edit functions.php to make a sticky post, the flow is post a post, clock will start and after 1 hours, the post will be disappear. Anyone can help me? Please. I have tried, I am really new ...
0
votes
1answer
76 views

Remove css styles from specific page

I need to remove all theme (both child and parent) css styles from a singular page using functions.php in a child theme. Here's what I'm currently adding to the child's functions.php // import parent ...
1
vote
1answer
48 views

Modify custom field input data before creating a new post

I'm try to check input data before it is added to DB. For example: I have a custom post meta named book_isbn in post page. I want to make sure that this variable $_POST['book_isbn'] is valid before ...
0
votes
1answer
46 views

How to stop or remove an action being called inside a function of an extended class

The Problem I am trying to remove an JSON+LD block being added by a WordPress plugin called The Events Calendar. I believe it is being added by the function called: ...
0
votes
1answer
18 views

I want to get product attirbute in the section below

I want to add product brand and weight which i have defined in attribute of product but it am using the <?php $weightvalues = get_the_terms( $product->id, 'pa_weight'); foreach ( ...
0
votes
0answers
29 views

How to send Email to Dealer email id when order is cancelled woocoomerce

I am trying to send the mail to my Dealer which user has choose during checkout that your order is cancelled . I have prepared a system to which sends email when order is placed my code is ...
1
vote
1answer
40 views

Is there a way to add a class to non current menu item?

When using the wp_nav_menu function, the current menu item markup usually is like so: <li id="menu-item-19" class="menu-item menu-item-type-post_type menu-item-object-page current-menu-item ...
0
votes
1answer
73 views

How to get post category list as select in front-end?

I use widget plugin Getting the random post & URL via ajax. I want to add function, that allows users on frontend choose category, and than display random posts from this category. function ...
0
votes
2answers
111 views

Wordpress can't get jquery/unslider to work [Solved]

I don't know what I'm doing wrong... I'm using the starter timber theme... I'm trying unslider to work with my theme... indicated here is somehow a proof I did right in putting scripts from the ...
0
votes
1answer
37 views

Simple JS function Not Working

I have been trying to get a simple JS function to work for the longest while but its just not working. Console says "test is not a function. echo '<input type="hidden" ...
0
votes
1answer
71 views

srcset and custom field get_post_meta and wp_get_attachment_url

I would like to use the new wordpress 4.4 function srcset with an image which comes from a custom-field like this <img src="<?php $bigimg = get_post_meta($post->ID, 'bg_file', true); echo ...
0
votes
1answer
39 views

Display Year and Month from custom field + Age Calculator

I have a custom field "DOB" on my custom post type which is in [Ymd] format. I want to compare that date of birth to current time and want to show "You are # years # months." I am able to calculate ...
1
vote
1answer
20 views

How do I customize my wordpress Admin Area?

I'm building a wordpress multisite which is aimed to serve as a blogging platform but I wanted to customize the admin area for my users by removing all the dafult widget. Please , Is there a wordpress ...
0
votes
0answers
17 views

add post type support not showing edit author options for all users

Need to allow all users (admins) to be able to edit the authors of a post. Added this to my wp-admin.php in the inc/functions folder but is hasn't worked: add_action( 'init', ...
0
votes
1answer
52 views

enqueue multiple Google fonts with multiple weights and styles (italic).

I am trying to enqueue multiple Google fonts with multiple weights (400,600,700, etc,) and styles (normal, italic) and can't figure out why it is not working. This is the code that I am using in the ...
0
votes
0answers
35 views

Removing A Parent Theme Template

There is a template with code that I want to prevent the child theme from loading. All it does is load a little date box. What i've done is duplicate the hierarchy of that template file located in the ...
0
votes
1answer
33 views

Allow authors to post only in categories they create in WordPress

I'm looking for a way to allow users with an assigned WordPress role (in my case, author) to create new categories and then automatically be restricted to only posting in those categories or the ...
0
votes
0answers
26 views

wp_verify_nonce() didn't work in the function

I'm creating link with wp_nonce in GET parameter: $link = esc_url( wp_nonce_url( add_query_arg( 'my_arg', 1 ) , 'product_subscription' ) ); echo '<a href="'. $link .'">'. $link .'</a>'; ...
-1
votes
1answer
58 views

Sync roles across several plugins

Here is the setup: I am implementing Wordpress with two specific plugins: Ultimate Members and Yith Vendors which is a woocommece addon. What I need to do is change a field's data in the database ...
0
votes
0answers
18 views

Everytime I press Save Settings from a Plugin it redirects to All Settings page

I have developed a settings page for a theme in which I'm working in order to have some options to customize it. Here are all the options and here is the functions.php. I don't know why but when I'm ...
1
vote
0answers
16 views

Create a Button alongside add to cart

i want to create a button alongwith add to cart that will perform a specific function. please tell me how to do this.Also can you tell me the css of this button so that the button looks exactly like ...
0
votes
0answers
23 views

How to protect a comment with a password?

Is there any way to Protect a comment with a password so that the comment can be seen only when the right password is entered. I know a post can be password protected , but thats not the way i want ...
1
vote
2answers
208 views

How to use WordPress (PHP) functions in AngularJS partials files?

I am using AngularJS to load a list of my WordPress posts, however I can not get any of my PHP functions to work with my partials file. I've tried using something such as search.php instead of ...
0
votes
1answer
72 views

Check if has any sidebar active on current page

Is possible to check if has any sidebar active on current page? Like this: @edit This function also return true even if the current page does not have this sidebar active... <?php ...
0
votes
0answers
27 views

Function returning same value for all posts

I have this function to get the size in KB from a file. It works like a charm as long as it's on a single post. However, if I do a query, all posts take the value from the first post. Thus, if the ...
2
votes
1answer
49 views

IF Statement in Wordpress

I can't seem how to correctly use the php if statemnt in my add filter function below. This code works perfectly if all (3) of my $_POST inputs have values however it has a fatal error if any are ...
0
votes
0answers
32 views

Entire site breaks when error in a php file because of multiple get_template_part in functions.php

I bought a WordPress template and I'm modifying it to fulfill my needs, But I have a problem. Whenever I there is an error in one PHP file, the entire site (including the homepage) breaks. I see that ...
0
votes
1answer
20 views

Displaying text if post was within 5 hours

Currently I have the following string. $timeago = human_time_diff( get_the_time('U'), current_time('timestamp') ); print $timeago; This returns results that looks like this. 1 min, 1 hour, 1 week, ...
0
votes
0answers
27 views

Javascript attr href not appending parameters on WordPress site

I have this exact code set up and running on a regular HTML/PHP site but when I tried setting it up in WordPress, it doesn't work. The code itself works, the Javascript is present when I view the ...
4
votes
1answer
55 views

Paged Single Post doesn't redirect to the main url after Removing Pagination

I used <!--nextpage--> (Codex) to paginate (split) a few single posts. Now i removed all the nextpage html parts from the posts. everthing looks fine. Unfortunately the old urls like ...
0
votes
0answers
35 views

add_menu_page and URL parameter

It is possible in WordPress to add a url parameter to the add_menu_page slug? Only found solutions for a submenu page. Odd thing is that if i add a node to the admin bar which has the link ...
0
votes
0answers
42 views

Custom WP Admin pages do not display after trying to add child to functions-admin.php

I am building a theme options page. I have a parent page with 3 sub-pages under that. Volcano (Parent) Sidebar Theme Options Custom CSS The Problem: All of these settings are not displaying at ...
1
vote
2answers
92 views

Change size and crop medium_large images

I use events manager pro plugin to show an eventslist. These event-list is showing their thumbnail image in the new (wordpress 4.4) wordpress image size "medium_large" (width 768px). I need an image ...
2
votes
1answer
62 views

Check if page parent has certain template

I want to check if a page has a parent with a certain page template attached to it. If I know that I can determine which scripts to load or not. Normally I would just get the page template and if it ...