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

measuring the comments of my blog with events in google analytics

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
14 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
31 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
19 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
13 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
37 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
37 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
10 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
33 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
25 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
13 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
13 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
11 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
18 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
15 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
16 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
18 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 ...
-4
votes
0answers
16 views

Function to show an image from template directory [closed]

I need something similar to this function(pseudo code): function my_loader_image() { echo 'an image from template directory'; } add_action( 'easy_import_start', 'my_loader_image' ); Any ...
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 ...
-1
votes
0answers
21 views

I am getting an Failed to load resource error in a child theme function.php file [closed]

This code that I am using in my child themes functions.php file has an error I can't find. wp_register_script ('quotes', get_stylesheet_directory_uri() . ...
0
votes
1answer
36 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
13 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
11 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
20 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
49 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
22 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
75 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
13 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
43 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
42 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', ...
0
votes
0answers
7 views

How to make child class use the same signature? [duplicate]

functions.php class themeslug_walker_nav_menu extends Walker_Nav_Menu { function start_lvl(&$output, $depth, $args) { $indent = str_repeat("\t", $depth); if('primary' == ...
0
votes
1answer
40 views

WordPress dynamic AJAX query

Aim - I've trying to run a query based on which category is selected from the dropdown. I figure the best way to do this, is to dynamically use AJAX and pass the category value held by a variable to ...
-1
votes
0answers
8 views

Search result giving blank page with pagination

I am working on WordPress website and created a theme from twenty fourteen theme, Now m facing a problem related to search result, When I search any world it gives me result in pagination but content ...
0
votes
0answers
18 views

get_comments function returns diffrent values on different accounts, why?

If I am on my admin user, the function get_comments() returns the array of comments in the template, but for the subscriber, the array is just empty. I tried to add permission to the user but it ...
0
votes
0answers
7 views

RSS Feed Notifications

I'm creating a site that pulls RSS feeds from various blogs & displays their latest posts. On the category/archive pages, I'd like to show a small notification on each post whenever there is a new ...
3
votes
1answer
108 views

How to display random users with avatars

I adapted a little a function to display a number of random users with their avatars with a shortcode. It works, but something is not good. Sometimes it displays with one user less than I want (just a ...
1
vote
5answers
170 views

Display height and width properties with the_post_thumbnail() or related function

Problem I want the height and width properties in the img element of the Featured Image for a post, page, or custom post type. Environment I have a custom theme based on the BlankSlate theme. The ...
0
votes
0answers
27 views

custom function for wp_list_categories

I need to write a custom function for wp_list_categories so instead of displaying a hierarchical list of links they are instead a list of checkboxes with the parent terms being displayed as h3 tags. ...
0
votes
1answer
41 views

How to override a theme function (within a class) using a plugin

I am working a website which utilises a highly complex theme (essentially a whole bunch of other software tacked onto Wordpress), so complex in fact, that child themes wont work with it. I want to ...
0
votes
0answers
28 views

Problems after changing URL from my-site.net/blog to my-site.net

After I changed site url (in general settings) to http://www.my-site.net I can't access my wp dashboard and my site is loaded very slow and only HTML elements are loaded First thing that I did was ...
0
votes
0answers
22 views

do_action filter function from add_action array

I am looking at the following setup: -- Combing multiple functions into single action -- add_action( 'single_post_meta_start', array( $this, 'the_title' ), 10 ); add_action( ...