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
0answers
26 views

Accordion Menu not being called

I'm trying to add a vertical accordion menu to my custom theme, and I have no idea what is not working. The original tutorial is here : http://cssmenumaker.com/blog/wordpress-accordion-menu-tutorial ...
0
votes
0answers
9 views

How can I enequeue GruntJS concat imagemin output?

After reading countless tutorials and learning how to output solid files using both the concat and imagemin plugins for GruntJS, I have yet to see how I can actually include the output files into my ...
0
votes
1answer
29 views

How to use functions [closed]

I have installed the plugin WPdeposit on my site, it allows users to deposit into their account balance. I am trying to manipulate users balances when they press an anchor tag on the page. In the ...
0
votes
2answers
102 views

Excerpts are not displayed by a shortcode on category pages

A 3rd party plugin that I use adds a shortcode that displays a list of adverts (CPT posts). The shortcode function includes (with an include statement) a template - the list.php file, that displays a ...
0
votes
2answers
42 views

PHP Output also in Child theme, but different

I have a multilingual site setup: www.jeroenbrugman.com The main dutch version uses Fluxus. On the artwork page I output a link using this from Functions.php function prefix_term_name($terms, ...
1
vote
1answer
95 views

Limiting woocommerce line_total decimal length

I am trying to get line_total woocommerce price, but i just cant figure out how to deal with number of decimals. It is now showing price with 4 decimals like 5.5444$ and i want it to show max 2 ...
0
votes
2answers
51 views

how to repeat taxonomy in different places on wordpress

I need help with this. I need repeat taxonomy in two places, are post, and coupones post, this code is in clipper theme. this code put taxonomy stores in coupon. add_action('init', 'clpr_post_type', ...
0
votes
1answer
111 views

Do we need to change our child function.php to require/include child dir files when we add an over-riding file.php into the child theme

With child themes we are supposed to leave parent functions.php in tact and extend it with the child functions.php. However parent functions.php typically define a whole load of include/requires which ...
0
votes
1answer
51 views

Find all strings between an enclosing shortcode

I want to look for all strings in my theme located between my enclosing shortcode [question] desired string [/question]. Then I want to output the so collected strings somewhere in my theme , e.g. ...
0
votes
2answers
59 views

Pass Shortcode Attribute to footer Script

i am trying to generate a wordpress shortcode which will display a (bx)slider. The shortcode function itself works like a charm, i can pass my data and the shortcode gets rendered well. The problem: ...
0
votes
1answer
83 views

using `require` in my functions.php breaks the site

So, I have a snippet of code I'd like to tidy away in a directory that's close to the root my wordpress directory. Specifially it lives in /includes/inc. I've created a file called test.php and ...
0
votes
1answer
34 views

Retrieve a custom form field modified by a filter

I use a 3rd party plugin that creates a form with some fields. I want to use one of these fields in one of my templates. Is there a way to do this? UPDATE I found a solution, see the accepted ...
0
votes
1answer
50 views

Splitting the_content() by size?

I have a situation where users don't want to format quotes in post body and want to just paste their content, assign a quote in a custom field, and the template will now render the quote when viewing ...
0
votes
2answers
20 views

Adding wrapper elements in the_date() like in the_title()?

So this works: the_title( '<h1 class="entry-title">', '</h1>' ); But this does not: the_date( '<h4 class="entry-date">', '</h4>' ); I don't know enough if this is ...
0
votes
1answer
38 views

Make menu structure match page heirarchy on page parent change

Old WordPress themes like twentyten contained functionality which allowed nav menu structure to reflect changes in page heirarchy. For example, if I have the arbitrary page heirarchy (and matching ...
0
votes
1answer
50 views

Improving the perfomance of a plugin action

I want to override a 3rd party plugin action with a new action, but in comments to my another question @pieter-goosen suggested that this plugin action is very very expensive, in terms of using server ...
0
votes
2answers
37 views

Call custom field using php

function the_alt_title($title= '') { $page = get_page_by_title($title); if ($p = get_post_meta($page->ID, "_x_entry_alternate_index_title", true)) { $title = $p; } return ...
2
votes
2answers
216 views

Delete expired posts after a number of days after they expired

I use the below code to delete custom posts with status 'expired' (thanks to Jamie Keefer). Posts are set as 'expired' by a 3rd party plugin. Users have only a frontend access to their posts ...
0
votes
1answer
60 views

wp_create_category deprecated?

Was trying to use this today: WP Create Category https://codex.wordpress.org/Function_Reference/wp_create_category Trying that (which I also assume it's only going to add terms to the built in ...
0
votes
0answers
17 views

function 'wp_heartbeat_set_suspension' not found or invalid function name

Woke up to find this error mysteriously appear on the admin pages of my website Warning: call_user_func_array() expects parameter 1 to be a valid callback function 'wp_heartbeat_set_suspension' not ...
1
vote
2answers
63 views

Two different menus for two different locations?

I'm trying to change the menu in a primary and a secondary menu depending on the page which is visited. My primary menu is in the top of the page, and it looks like this: Index | About | Contact ...
0
votes
0answers
32 views

How set offset on query with specific post_type from functions.php

I have a page template called 'page-blog.php'. On that page I have 2 queries that both obtain the posts of a different post type like so: $posts = ...
0
votes
2answers
47 views

is there a benefit in using a constant over get_stylesheet_directory_uri?

Is there any benefit perfomance wise when defining a constant in the wp-config.php like so <php define('PATH_TO_THEME', get_stylesheet_directory_uri() ); ?> and then referring to ...
0
votes
1answer
59 views

Add URL Rewrite Rule To Wordpress

my link http://localhost/abm/?ct_city=la-jolla&search-listings=true i want to this http://localhost/abm/USA/la-jolla Could you help please.. htpaccss file # BEGIN WordPress <IfModule ...
1
vote
1answer
42 views

How to target only the front page (not subsequent paginated pages) in theme/plugin?

I'd like to switch on the front page ONLY. Not subsequent paginated pages (like ?paged=2). I want to output certain output only on the "true" front page of the site. I've tried: <?php if ...
0
votes
0answers
22 views

Function for moving a sub menu under a different top level menu?

I have a snippet that will allow me to make submenus become top level menus, but can you help with a snippet that will allow to move a submenu to be the submenu of a different top level menu? For ...
1
vote
1answer
82 views

Woocommerce - remove product from category

I'm trying to do the following, but I'm stuck with coding. Hope someone can help me out here. In Woocommerce (on the product-edit page) I can choose in which category the product will be. I made a ...
0
votes
1answer
23 views

Where to put random functions?

I have functions for setting default values when a new user signs up, I have functions for performance testing, I have functions for writing out a small icon to the admin tool bar, and so on. These ...
0
votes
1answer
17 views

Overwriting a plugin function

I need to write a function in my own plugin and overwrite a function from another plugin and (preferably) not make any changes to it. Or WordPress' core. So, basically, what I need to happen is: ...
0
votes
0answers
23 views

How to integrate a code through function

so I'm having this big issue with replacing a code with another via function. I just copy pasted an example code from the plugin developer which at the moment is unable to assist me. This is the code ...
0
votes
2answers
70 views

Adding multiple taxonomy filters to functions.php

I need to add multiple taxonomy filters to the functions.php file to remove (3) irrelevant taxonomies from the Yoast SEO sitemap index. I have been able to successfully add one filter, but when I add ...
0
votes
0answers
23 views

How to get a variable into a buddypress function?

I have a function to create profile subnavtabs in buddypress: function my_custom_subnav() { global $bp; $collection_term = 'FOO'; bp_core_new_subnav_item( array( 'name' => ...
0
votes
0answers
30 views

Pagination not displaying

I'm using HTML5Blank theme to edit my own theme on clean basis, and trying to set the pagination but it's not displaying for some reason, and I cant find out why. Index.php calls loop then pagination ...
0
votes
5answers
1k views

How to run a function every 5 minutes?

I have a function to be run every 5 minutes. I've referred following from the codex: <?php wp_schedule_event(time(), 'hourly', 'my_schedule_hook', $args); ?> I want to run this function just ...
0
votes
1answer
38 views

Add action to custom Function

I am trying to use plugin action in my custom function. Plugin is adding an action to wordpress registration form add_action( 'bp_before_account_details_fields', 'tv_bp_avatar_upload_form' ); But ...
0
votes
1answer
132 views

Option Tree integration of Custom CSS

I would love to integrate Custom CSS field from my Option Tree plugin to the code, but if I try to integrate them following way into functions.php, it ends up with Fatal error: Call to undefined ...
0
votes
0answers
36 views

Call attributes from shortcode function to a JavaScript function?

How do I call attributes from shortcode function to a JavaScript function? extract(shortcode_atts( array( 'xyz' => '' ), $atts )); I want to call xyz's value in ...
0
votes
1answer
48 views

Is this an acceptable practice for WordPress theme development?

I don't think this is the right way to do things, maybe I'm wrong or missing something but to me it seems unnecessary. Is this correct? What are the implications if any of doing things this way? In ...
0
votes
0answers
29 views

Add action after function defined in plugin

I'm trying to write my second ever plugin (my first was a derivative of Hello Dolly) and I have a function that does something, however my issue is that I don't know what action to use to call my ...
0
votes
0answers
133 views

Custom taxonomy not refreshing page on add

I have created a custom taxonomy for use with WP Job Manager. The taxonomy shows up, however when I type in my tag and click the "add new job title" button nothing seems to happen. If I click refresh ...
0
votes
0answers
27 views

How to let users “follow/subscribe” tags (part is working)

I've searched for this for a looong time; My users should be able to follow/subscribe a tag than on a second front page, they only get posts from the subscribed tags. In the following example, in the ...
1
vote
1answer
74 views

Check if a menu is empty?

I have menus set corresponding to a custom field on a page. Ie I have menu1, menu2, and menu3 on three pages under custom field => MenuName. Under functions.php I have: /* Add Menu Locations */ ...
0
votes
0answers
122 views

500 error even after restoring to a working functions.php

While changing the functions.php file to edit who can see the wordpress toolbar I managed to return a server 500 error after the page as updating. I've since restored my backup of the previously ...
0
votes
1answer
33 views

How to change number of posts shown on homepage vs other pages?

I tried using this function but my homepage (which is the latest posts, not static) shows 5 posts -- the else. function limit_posts_per_page() { if ( is_front_page() || is_home() ) return 1; ...
1
vote
1answer
120 views

meta tags doesnt fetch data from permalinks

i have a page http://studyofjoy.com/categories/ i want to add custom meta tags to heading section like this: <meta property="og:title" content="<?php echo "title:" . ...
0
votes
1answer
63 views

Enqueue less file not working in child theme?

In my child theme I have: add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' ); function theme_enqueue_styles() { wp_enqueue_style( 'parent-style', get_template_directory_uri() . ...
0
votes
2answers
32 views

Add loggedout class on body using a function or JS

Is it possible to add a class loggedout on the body of every page for all logged out users using a function or JS? My theme already adds a class 'loggedin' for all logged in users.
0
votes
0answers
38 views

Add Title Field To User Profile Page

Looking to add a title field to user profile which is shown above First Name field. I can add custom fields using this code but I can't figure out how to change the position of the title field to ...
0
votes
1answer
26 views

Template code to split a post and print a custom field?

So I want a blog post but in the center of every blog post I want to split the content and print a custom field attached to the blog post type. Ie you field called "Blog Quote" and the user will ...
0
votes
0answers
45 views

is_page_template wont allow me to enqueue scripts

I want to load specific javascript files onto any page that uses the template hello-world.php below is the code that I have used to target the page, register and enqueue scripts. But for some unknown ...