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

Trying to get property of non-object in: $wp_query

I've this function at functions.php file: function custom_secondary_nav( $menu_name, $id = '', $menu_title = '' ) { global $wp_query; // others stuff goes here if ...
0
votes
1answer
122 views

Modify shortcode to work with custom post types

I have this shortcode which works fine with posts but I need to modify it to take arguments for custom post type and custom taxonomy. <?php // [blog_posts] function ...
0
votes
1answer
37 views

WordPress HTML Helper

I've played recently with WordPress Hooks and I've noticed that in order to create layouts based on the hooks the main practice is to use html in functions and combine them with logic. I've searched ...
0
votes
0answers
34 views

“View Gallery” Button to open post gallery

I want to create a "View Gallery" button which opens the gallery attached to the post. I have tried: <div id="gallery-1" class="gallery"> <a class="attachment-thumbnail" ...
0
votes
1answer
31 views

Modify sub_menu function to show pages below a specifically set page

I've got a function that ties in to wp_nav_menu that shows sibling pages for the currently viewed page, as well as any children pages. I need this modified to only show the children pages of a ...
0
votes
1answer
18 views

Figure inlined width trigger distorted layout

I recently changed my theme to completely new one (fresh), and all my post images suddenly started to break my layout. When I inspect code all images and loaded content that are wrapped in 'figure' ...
0
votes
2answers
44 views

Changing the color of post title [closed]

Alright I am starting a music blog and I am working hard at coding up this theme but I am wondering why I can't do this successfully within WordPress when I know for sure it's possible. Alright so ...
0
votes
1answer
86 views

Creating A New Admin Menu Tab For Theme Options

I 've found an online tutorial that teaches how to implement a simple Options Page for the theme. I did it successfully but it is displaying as a sub menu, and I want it to be a main menu like those ...
1
vote
0answers
50 views

Customize default settings on new sites on multisite

As the title states i need an approach to change default settings when a new site is created on my wordpress multi site. I guess its easiest to keep the code in a mu-plugin but can a go about having ...
0
votes
0answers
38 views

using a function in functions.php to process a form generated in functions.php

so i have a site where users can rate items, it saves their ratings to a mysql db and also tallies the average for the item, saving that as well. as it is a generic function and there are hundred of ...
0
votes
1answer
56 views

Sort search with posts_orderby

I need to sort my search results by custom post type. the problem: the order is custom. I do have 5 different post types and i got the order like so: artist artwork page post publication I'd like ...
0
votes
1answer
42 views

Twitter Product Cards

I am trying to show twitter product cards. I have this function in my functions.php . I validated the twitter card and everything looks good except the product data. I am trying to display it for ...
0
votes
1answer
23 views

How to hightlight all ancestor menu items of a child page NOT displayed in menu

Here's the situation: In my main navigation menu I have something that looks like this: Work with Me Latest Projects Where the Latest Projects page is a child page and sub menu item of the Work ...
1
vote
1answer
61 views

What do the schemes login, login_post, admin, and relative mean?

site_url and get_site_url accept a parameter named $scheme. $scheme can be set to http, https, login, login_post, admin or relative. http and https are obvious. What do login, login_post, admin and ...
0
votes
0answers
32 views

Add custom class to all URLs on entire site

I have a mobile touch script which uses the class "tapover". Now I want to insert it to all URL links on my entire site. How do I do that? Update: function strapboot_enable_mobile_touch() { ?> ...
0
votes
0answers
45 views

Created a function similar to facebook events with [ Attending / Not attending ] options

I modified and extended an event plugin on wordpress that is being hosted on GITHUB then finally came up with this idea in a separate PHP file and added options such as the ATTENDING and NOT ATTENDING ...
0
votes
0answers
20 views

CDN issue with custom image shortcode

please read the full question before downvote this question. In my theme my developer uses a shortcode for adding image in a custom post type named portfolio. Everything is good and working fine, ...
0
votes
1answer
73 views

How to add author's posts link (HTML + PHP) inside a function to output it

I have this function on a theme which is a bit of code for a slider: function get_article_slide( $title, $excerpt, $link_article, $url_image, $title_length, $alt_image = 'Alternative text' ) { ...
0
votes
0answers
25 views

Problem with wp_login_form()

I'm using wp_login_form(); to display the login form in the front-end. And added after that do_action('login_form'); which should display capacha verification from a plugin. The problem is that the ...
2
votes
1answer
172 views

Implementing DNS Prefetching with WordPress

I'm not sure whether my question sounds promising or not but what I'm going to ask is very much relevant. So please read the full question before down voting or flag. I'm trying to implement DNS ...
1
vote
1answer
64 views

Overwriting Parent Theme's Image Sizes

I'm using Raw by UDTHEMES as a parent theme for a site I am working on. In the parent theme, there is the following image size: add_image_size( 'udt-full-width-image', 870, 490, true ); And I am ...
0
votes
1answer
95 views

wp_nav_walker that interacts with widgets to setup mega menu

I'm a newbie WordPress developer working on a WordPress theme project that demands mega menus as part of the main navigation. I'm done with the front-end stuff, and now I'm trying to explore the ...
1
vote
1answer
398 views

Can't get post ID in functions.php?

I need the current post id in a function , which I have written in functions.php. But I can't get the id . I have tried several method . Like get_the_ID() ; ----returns false global $post; ...
0
votes
1answer
55 views

Custom meta box save values issues - Deprecated: Function ereg() and more

I'm a WP theme dev nobie and I have problems with saving custom meta boxes values. I found some tutorial where its explained how to do this. I have included a file called custom-meta-boxes-save.php ...
0
votes
2answers
54 views

Conditional Page Template not working

I am using this code in functions.php to conditionally load some shortcodes but it doesn't work. The shortcodes are still loaded on template-flat.php. Any ideas what's wrong here? if( ...
0
votes
3answers
73 views

Enqueue Style in Functions.php

This doesn't work for me in functions.php: if( is_page_template( 'template-flat.php' ) ) { function flatsome_scripts() { wp_enqueue_style( 'flatsome-style', get_template_directory_uri() ...
0
votes
1answer
63 views

Exclude Empty Child Categories in Menu

I am working in WooCommerce and trying to filter out the empty sub categories. I found this code, which filters out everything "empty"...including my Home page link, About us link, etc. function ...
0
votes
2answers
73 views

Pagination fault in custom post type archive page [duplicate]

I create ad custom post type register_post_type( 'videos', $args); and custom taxonomy for that register_taxonomy( 'video_category_categorie', 'videos', $args ); Maximum number of post displayed is ...
0
votes
4answers
112 views

Is it legal to redefine wp_password_change_notification in a mu plugin?

I am trying to add some logic to this function of when to alert the admin to a password change but no email is being sent at all. The codex says it needs to be declared in a plugin, so is this legal ...
0
votes
1answer
88 views

Conditional functions.php on page template

I am creating a new page template (which essentially i am taking bits and pieces from a new theme). I have called this template-flat.php Now in functions.php I am looking for a conditional statement ...
0
votes
0answers
26 views

wordpress use single ajax in place of multiple ajax requests in a smarter way

In wordpress I have database tables like this product name id product_name 1 A 2 B 3 C 4 D product_buying_price id product_name product_buying_price 1 A ...
0
votes
0answers
59 views

How To Get WordPress Categories Last Update Date?

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 save it. Now all things is working fine but I want to get the date ...
1
vote
2answers
96 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
47 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
149 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
58 views

Sort and display pages with specific custom field (not 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
162 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
41 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. ...
-1
votes
1answer
43 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
66 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
62 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 ...
0
votes
1answer
58 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
23 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
76 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
1answer
26 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 ...
2
votes
1answer
82 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
36 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
24 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
86 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
137 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 ...