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
vote
2answers
11 views

Custom post status not working

I'm trying to create two custom post status'. I used the Codex to generate the code and that didn't work. Then I went to http://generatewp.com/post-status and it didn't work either. It isn't showing ...
1
vote
1answer
19 views

How To Get WordPress Categories Link List?

I am trying to make a custom sitemap for my WordPress blogs categories. For that I added the below code in my functions.php file and when I save it, my Blog goes white. Nothing is showing up. I ...
0
votes
1answer
29 views

Function/Class to list categories with checkboxes

I want a list like in the pictue; witch is here - Posts->New->Select Categories At the moment i have this echo '<select name="pn-cats[]" size="8" style="width: 100%" multiple>'; $args = ...
0
votes
3answers
25 views

Sort and display pages with specific tag

What I need basically is to display child pages on a parent. But I want to split the list of childs to, lets say, 'important' and 'non-important' to display it at the beginning and at the end of a ...
0
votes
1answer
26 views

Fatal error: Call to a member function get_page_permastruct() on a non-object

I get this error Fatal error: Call to a member function get_page_permastruct() on a non-object in C:\xampp\htdocs\wordpress\wp-includes\link-template.php on line 358 when i call this function ...
0
votes
1answer
20 views

get_pages() Returns Only One Item

I'm trying to list the children of a specific parent page for use in a shortcode using get_pages(). Unfortunately, only one page is being displayed though there are many more that should be displayed. ...
0
votes
1answer
21 views

Adding css tweak based on page template

I have a parent page that is listing out all of it's child pages. This is done using the below: <?php $query = new ...
0
votes
0answers
31 views

How do you add content to a WordPress sub-menu dependant in its parent?

What I'm wanting to achieve is this: A submenu with content showcasing 1 product from each category after the links In the submenu. I am trying to use the WordPress nav walker to add the content ...
0
votes
0answers
24 views

Insert <!--nextpage--> after every x img tags in a post

I want to insert <!--nextpage--> after every 10 image tags in a wordpress post (if there are 30 images, I'll get 3 pages), but I can't seem to figure out how to do it. I found a php function that ...
-2
votes
0answers
12 views

Masking YITH ADD TO WISHLIST link [on hold]

I want to hide yith add to wishlist link which shows as http://www.domain.com/wp-content/plugins/yith-woocommerce-wishlist/yith-wcwl-ajax.php?action=add_to_wishlist&add_to_wishlist=ID i want it ...
0
votes
0answers
19 views

Google map API theme option page not displaying

I'm having some issues with the integration of a google map in my web site which can geocode an address before displaying the map with the correct location. So i have a script (it worked when i was ...
0
votes
1answer
24 views

wp wp_register_script function results type parameter missing

I used the following code wp_register_script('jquery', get_bloginfo('template_directory').'/js/jquery.js', false, '',false); wp_enqueue_script('jquery'); It includes the script as ...
0
votes
0answers
8 views

Getting mail recipient ID rather than current user ID

I have a custom email function in functions.php, that when an admin approves a user sends an email to them notifying them of this. However I need to add some custom data for each recipient, that I can ...
1
vote
1answer
14 views

Skt full width basic slideshow problem

Background: I am making a photography website and thought that skt full width is a good theme for the landing page. It worked out all right. Then I started to get fancy. I wanted my client to be able ...
0
votes
0answers
11 views

measuring the comments of my blog with events in google analytics [on hold]

for comments on my blog I have installed disqus . I set events in google analytics to measure comments in this way category empiezar by Disqus Action begins with New Comment I have given a value of 1 ...
0
votes
1answer
20 views

update_post_meta is Updating with two page id

I am writing a code to count the number of views of post. For that I am using update_post_meta and passing appropriate parameter. I am calling a function on add_action('wp', 'function_name'); in ...
0
votes
1answer
38 views

Add attribute to link tag that's generated through wp_register_style?

My original question was answered here: Google Fonts giving: No 'Access-Control-Allow-Origin' header is present on the requested resource. Is there a way to add the data-noprefix attribute to my ...
0
votes
1answer
22 views

save_post hook - headers already sent?

I'm trying to create a very simple alert for each time a post is created or updated with the below... add_action( 'save_post', 'updatedAlert' ); function updatedAlert() { echo ...
0
votes
1answer
11 views

Sharing functions between plugins

I asked a question similar to this, but after reading a comment from another question which states the functions.php file should not be used for plugin related stuff, I thought I would ask a slightly ...
0
votes
0answers
16 views

How to add a custom HTML attribute to a parent element of wp_nav_menu?

I am using wp_nav_menu and I want to add a custom attribute that I need for uikit drop down component (data-uk-dropdown attribute) This is how the HTML should look like: <ul class="uk-navbar-nav ...
0
votes
2answers
43 views

How can I create a page with a specific URL?

I would like to have a few pages which can be reached by anyone who knows the URL, but which are not listed on the WordPress menu. I would like those pages to have a name rather than a number, but I ...
0
votes
2answers
64 views

How to customize the_archive_title()?

In my child theme's archive.php, I have the following code for displaying the title of my archive pages: <?php the_archive_title( '<h1 class="page-title">', '</h1>' ); ...
0
votes
1answer
12 views

Call image from post on index page?

I am facing one problem in which i dont understand what I used to call the image from post in WordPress themes on front page where n numbers of image are show with there description and user can ...
1
vote
2answers
36 views

Add admin bar link to edit author

I am trying to allow my editors and admins to click to "Edit Author" as they would "Edit Post" or "Edit [Custom Post Type]" from the admin bar when they are on a page like /authors/jdoe (Note: I do ...
1
vote
1answer
31 views

Custom Post Type with Templates using Meta Boxes?

I have this issue where I need a CPT to have several layout options and use templates. Originally, WP does not support templates for custom posts, however I know its possible to do it manually via ...
0
votes
1answer
14 views

Widgets Section not displaying in theme customizer

When in the WP Theme Customizer, my widget management section isn't displaying (i.e. I can't add/change/remove widgets). I CAN, however, add widgets from the Appearance -> Widgets section, just not in ...
0
votes
0answers
15 views

post by Category not working after setting 4 post per page

I am trying to show 4 posts on my homepage that is working fine but whenever i click on sidebar post categories it still shows the 4 post from homepage i.e the filter doesnot works and it shows 4 post ...
0
votes
0answers
13 views

wp_get_referer function always returning false

I am trying to use wp_get_referer function along with "template_redirect" hook in wordpress like this function show_page_name() { $r = wp_get_referer(); var_dump($r); die(); } add_action ...
0
votes
0answers
22 views

Child theme - Overriding 'require_once' in functions.php

I am attempting to modify a wordpress theme with a child theme. My parent theme has the following function in its functions.php: require_once(get_template_directory() . "/includes/theme-styles.php"); ...
0
votes
1answer
31 views

Add a mature content warning to first-time visitors

I would like to ask visitors if they are 18+ at the first visit to my blog. If they click yes, they access the blog normally and next time they will not be asked. If they click no, they access an info ...
0
votes
1answer
16 views

How to Display a List of Child Pages For a Parent Page in WordPress

I need to display child pages on my parent pages. i have a code that is working but i need to set some codes to only show specific pages like to only show visibility public not all the pages. this is ...
0
votes
1answer
18 views

How can i call a custom method on submission of a custom plugin post type?

I have registered a custom post type .On submission of that page/ post can i call a custom method . How ? Can i add a method in plugin file and will it call on post type submission by ACF or any ...
0
votes
1answer
20 views

Set the Title of a Custom Post Type by code as Author's Username

For a Custom Post Type I want to have the Title to always be the Authors Username. So far I've: Limited each Author to only posting this type once so as to avoid conflicts. Added code to the theme ...
0
votes
2answers
119 views

Why is 'register_activation_hook' undefined?

I am just getting reaquainted with writing plugins, after writing a whole two about three years ago. Following some example code I found: if(!class_exists('QuizMaster_Plugin_Template')) { class ...
0
votes
1answer
38 views

Trying to use add_action and do_action with parameters

In my themes functions.php I trying to add a function with parameters (as a test if this works, not for the functionality) and it simply doesn't work. The parameters always arrive empty even if I ...
0
votes
1answer
14 views

if has theme mod

Does someone know how to write the next line in wordpress PHP, because i'm not that great with PHP. If_theme_mode has content echo { my content } else { other content }; thnx
0
votes
1answer
12 views

Expanding a function to call a plugin or show a link

I have added the following code to my functions.php to validate if a user is logged in before allowing them to fill out a form: function my_members_only_shortcode($atts, $content = null) { if ...
0
votes
2answers
12 views

Only load certain artists on this page

I have a wordpress page which loads all the artists in two columns... here is what I believe to be the relevant bit of code <?php global $paged; if ( is_front_page() ) { ...
0
votes
1answer
22 views

Nav-Menu not showing up

I would love for somebody to please help me because somewhere I am really miss understanding what WordPress is telling me. Alright so within my header.php I have the following code. <div ...
0
votes
2answers
25 views

Loop Through Categories in Custom Field

Specifically, I am using the add_image_attachment_fields_to_edit function. I have my declaration of label, input.. $form_fields["custom4"]["label"] = __("Custom Select"); ...
0
votes
3answers
50 views

How to use return in my custom function instead of echo

I'm creating a function in functions.php with a custom hook, and from what I've read somewhere, it's good practice to return instead of use echo in a WordPress function? Correct me if I'm wrong. ...
0
votes
1answer
25 views

How to print redirected query string variables to the page?

I have a basic redirection set up: function example_add_rewrite_rules() { $year = '(\d{4})?'; $make = '([a-z]{1,20})'; $model = '(.+)'; add_rewrite_rule( ...
0
votes
1answer
29 views

How to programmatically GET (to know) which Sidebar (or) which Menu is being used on Different Pages?

Lets say i want to detect such thing from the "functions.php" .. to know which Sidebar (or) which Menu is being loaded on current (whatever landed) page, how can i know? Lets say i have a few pages, ...
1
vote
2answers
77 views

Converting HTML Template to Wordpress Theme

While I was trying to convert a Static HTML page to Wordpress Theme , I had an issue . the page Doesn't run properly After Checking Google Chrome Console it turns that it loads the CSS file with the ...
0
votes
0answers
15 views

Can't generate thumbnail images

Having a very strange problem with this site I recently took over hosted on RackSpace. Seems whenever i upload a new image, it doesn't generate different sizes and I'm trying to get it where it will ...
0
votes
1answer
46 views

Call to undefined function get_header() not in index.php

I can call get_header() without trouble in index.php, but not in another file. I got Fatal error: Call to undefined function get_header() in C:\wamp\www\wp-content\themes\Grid\vignette_ibis.php on ...
0
votes
1answer
17 views

How to call a custom taxonomy term name inside a function?

With the following function, the content of another page is included into a page template, which is working fine: // add content of another page function show_post($path) { $post = ...
0
votes
1answer
34 views

How to add a meta information to the URL?

I need to put a post meta information to the URL: www.website.com/custom-taxonomy/postname-[metainfo] How to change the rewrite rules, that the content of this meta information is added to the URL? ...
0
votes
0answers
27 views

Is it possible to change parameters of Parent theme function in the Child theme?

I have a Parent theme with the following function: function getTourOffers($tourId) { global $aitThemeOptions; $params = array( 'post_type' => ...
0
votes
1answer
43 views

Why are some custom javascript files working but some are not

I added some custom javascript files to my wordpress page. I put them in the funcstions.php like this: wp_register_script('formfunctions', get_template_directory_uri() . '/js/formfunctions.js', ...