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

Show Custom Post Type Results

Hopefully someone can help me here. I have a custom post type and with this post type I am able to show the title in a select option. Now what I want to happen is when that title is selected it will ...
0
votes
1answer
20 views

Can I prevent the user from adding more than two levels deep of terms inside of a taxonomy metabox?

I'm in the process of creating a leveled tutorial structure in WordPress and want to build it so that it sets up the front-end with no code needed from the user. So far, I have a custom post type ...
0
votes
1answer
44 views

save_post not working

In order to create (or update, whenever a post is updated) a unix-timestamp meta, I used following code to fire on save_post. I pasted this code in functions.php. But I believe this is not working, ...
0
votes
1answer
40 views

Pull random comment from specific post, display on homepage with shortcode

I'm trying to display a random comment from specific posts on my homepage, using the solution that was provided here: ...
0
votes
3answers
70 views

Redeclare function (override) [closed]

What is the best method, to change the previously declared function into the new one? for example, there is already declared: function smth(){ echo 'aaa'; } and i want that it displayed not aaa, ...
0
votes
2answers
62 views

Using <!--more--> tag to output text in Genesis?

here's what i'm trying to achieve! HTML: some text <!--more--> some text when post is loaded: some text MY TEXT WHICH WAS ADDED TO THE MORE TAG some text on my old WP site, i used this to ...
0
votes
1answer
108 views

how redirect users to custom login page when “login to reply” is clicked? [duplicate]

I am building my website on Wordpress and I have created my custom login page.But for a post when an user comments and other nonlogged see the comment with along with a line down "Login to reply".And ...
0
votes
2answers
35 views

What's wrong with my use of plugin_url()?

I keep getting the following message in the browser Fatal error: Call to undefined function plugin_url() in My code at present: add_action( 'wp_enqueue_script', 'load_jquery2' ); function ...
0
votes
0answers
20 views

How to Overwrite validate_plugin function

How can I overwrite the WordPress validate_plugin function. I need to disable that function alone for my plugin, and it should not affect any other plugin. I don't want the validate_plugin function ...
0
votes
2answers
31 views

Including php files within template

Let's say in my theme functions.php file, I included a php file that's only accessible in the admin control panel and named theme-options.php. require_once ( get_template_directory() . ...
1
vote
2answers
82 views

Programmatically Set First Image as Featured

I have over 400 posts with images inside them, I have got a new template which requires a featured image for each post, something my last template did not require... I am wondering if there is a ...
0
votes
1answer
34 views

When Author add new post change default status to pending

Same as above when Author add new post change default status to pending instead of published
0
votes
0answers
145 views

How do I remove code from Genesis Framework?

From the Genesis Framework framework.php template, I want to remove genesis_markup( array( 'html5' => '<div %s>', 'xhtml' => '<div id="content-sidebar-wrap">', ...
0
votes
0answers
64 views

Add link to Shopping Cart on Woocommerce's Checkout page [on hold]

My question is a simple one, I think. I want to place a link or button on the Woocommerce Checkout page saying "Return to My Cart" (obviously linking to the cart page) but I want it placed just after ...
0
votes
0answers
97 views

Set thumbnail from URL, by grabbing image in functions.php

So I've written a whole bunch of functions, which are used to display Vine videos. I then have a shortcode which outputs the code. The last thing I have to do is set the post thumbnail. I want to be ...
0
votes
0answers
15 views

Function that returns all pages that uses a specific page template? [duplicate]

Is there a function that gets me all pages that uses a specific page template? Something like this maybe: get_posts( array("type"=>"page", "page_template"=>"my-template.php") );
-2
votes
1answer
34 views

Changed functions.php file and now site is blank [closed]

I tried to change the functions.php CSS page, commenting out the original load fonts function and replacing it with my own. Now, when I try to access the site, I just get a blank page. Even worse, ...
0
votes
1answer
421 views

Why a SlideShow (made using JQuery FlexSlider) can't work if I load it form functions.php but work if I load it from my footer.php file? [closed]

I have the following situation: I am carrying this pure HTML theme (that use BootStrap CSS framework) into a WordPress theme. This is the original pure HTML demo theme (I have the entire source code ...
-1
votes
1answer
21 views

What is wrong with this dbDelta syntax?

I know there's a million questions about this, but I've searched a bunch and haven't found any solutions that fix my problem. This is the function which I hook upon plugin activation: global $wpdb; ...
0
votes
0answers
19 views

Wordpress Native Function To Show Publish Box, Select Categories Form etc On Plugin Page

The picture above showing the default forms those are available on metabox of wordpress post/page editor screen. Is there a wordpress native function to show those forms on a custom plugin page ...
0
votes
2answers
60 views

Why I can't load my JavaScripts using an hook inside my functions.php file?

I am pretty new in WP (I came from Joomla) and I have the following problem: I am carrying this pure HTML theme (that use BootStrap CSS framework) into a WordPress theme. This is the original pure ...
0
votes
1answer
32 views

Syling Custom Fields echo's from from functions.php

With the help of User Borek I've managed to get Custom Fields displaying on my siteby putting the below in the functions.php: function custom_field_before_content() { if(is_page() || is_single() || ...
0
votes
2answers
73 views

Load parent theme files before child theme functions.php

I am creating a theme framework to use in future wordpress themes that I develop. I would like to include dependant files such as classes inside the parent theme before the child theme functions.php ...
0
votes
1answer
27 views

Overwriting a Shortcode

I have a theme that extends the Visual Composer plugin with a slider on the front page. The slider will show five testimonials from five different customers. I want to add the featured image of each ...
0
votes
1answer
44 views

How to use get_template_directory_uri() to load an image that is in a sub-folder of my theme?

I am pretty new in WordPress and I have the following doubt about how to insert in my homepage an immage that is in a subfolder into my theme directory. So I have the following situation: Into my ...
-1
votes
1answer
31 views

Display Video as Post Thumbnail

I use the Nova free theme, from the Theme in Progress studio. I would like to display a video like a thumbnail image, as shown in this theme http://themeinprogress.com/demo/sueva/ How can I do this? ...
1
vote
1answer
42 views

Adding a class to tag list in a function

How can I add a class to the function so I can style the output tags as boxes in css? <?php if(get_the_tag_list()) { echo ...
0
votes
1answer
30 views

fire action when post is being edited as well as saved?

I'm trying to fire some code when a page is edited and/or saved. This code works: add_action( 'save_post', 'add_promoted_meta_data' ); function add_promoted_meta_data( $post_id ) { echo ...
0
votes
2answers
62 views

Order get_users() by last login date. Is it possible?

I want to create a page that displays all the blog users ordered by the last login date. I've tried with the get_users() function and I can succesfully get the users' list, but not in the order I ...
0
votes
1answer
34 views

Shortcode to output get_header not working

I'm trying to create a shortcode that will output the contents of one of my template header files. I created the shortcode in my functions.php file function zoo_header(){ return ...
0
votes
2answers
46 views

Some questions about how proper add 2 CSS file in a WordPress theme?

I have the following situation loading a CSS. I have a WordPress theme that load a style.css settings file by this code into my functions.php file: /* Function automatically executed by the hook: * ...
0
votes
0answers
31 views

Set Featured Post Automatically - First Image included IN the post

I want to set the featured image to the first image IN the post content. I've come across a few functions that grab the first image attached to the post. Sometimes a user will add an image to a post ...
0
votes
1answer
25 views

how to exclude in sidebar

I following insert adsense code. but post is less than count ,adsense appear to sidebar widget. how to exclude in sidebar? add_action( 'widgets_init', 'wpse_84250_register_ad_widgets' ); ...
0
votes
0answers
20 views

How to add a handler for a button in plugin?

I am working on my first plugin, and I am having some confusion. I am trying to figure out how to set a handler for a button on my plugin UI. Here is how the button is displayed: <li ...
1
vote
1answer
136 views

Successful or Error Message after running mysql code in functions.php

Just for this article, suppose there is a code that I want to run on my WordPress' functions.php file. It's a code to delete mysql table on my database. For example, here's the code: $wpdb->query( ...
0
votes
1answer
37 views

Retrieve First Image Function

I am using this function to retrieve the first image from a gallery in a post. However this doesn't work properly when I re-order the images in the gallery. It is stuck with the first image at the ...
0
votes
1answer
54 views

adsense code showing on random post thumb

I've followed the guide below, but have made a few edits to it and now i need some help: Add Adsense code in index.php I removed the following line from my code if ( ! is_front_page() ) return; and ...
0
votes
0answers
43 views

admin-ajax.php nulls all php variables

I have a problem in a custom function. The function which adds to the WHERE clause in Store Locator Pro works correctly on its own, but I only want it to only work on a certain page, not on all my ...
1
vote
1answer
62 views

Passing User_Fields to Contact form 7 [duplicate]

I'm trying to pass some custom field data to contact form 7 - The billing address and name and email address. I've created a function that pulls in these details from the database - is there an easy ...
1
vote
1answer
212 views

Problem only while using require_once() within functions.php

I use add_theme_page() within my child theme's functions.php implemented something like this... // other functions located here that create a custom options page in the Dashboard. // THIS IS NOT A ...
0
votes
0answers
58 views

Pass jquery var to a function in functions.php

I have this js in /js/functions.js: jQuery(document).ready( function($){ //Some event will trigger the ajax call, you can push whatever data to the server, simply passing it to the "data" ...
0
votes
1answer
68 views

How to call a plugin function in footer.php

I want to call this http://wordpress.org/plugins/easy-media-gallery/ easy media gallery plugin in footer.php or recommend me any image gallery plugin like its in the footer of this website ...
0
votes
1answer
59 views

Execute Jquery when a specific page in my plugin is loading

I am building a plugin and I would like to be able to hide the wordpress admin side menu and top bar when a specific page is shown(or menu item clicked)? Should I call the jquery directly as a ...
1
vote
1answer
66 views

How to show only one category in breadcrumb navigation

I added breadcrumb navigation to WordPress & I'm facing one problem. Here's the function.php code of the breadcrumb: function ux_breadcrumbs() { if (!is_home()) { echo '<a href="'; ...
1
vote
1answer
67 views

Function call via ajax – can't figure it out?

In my header.php file I've got … <script type="text/javascript"> var ajaxurl = "<?php echo admin_url( 'admin-ajax.php', 'relative' );?>"; </script> In my functions.php file ...
0
votes
1answer
37 views

Unable to add extra elements to the main navi (wp_nav_menu_items)

I'm trying to get the list of authors to automatically appear on the main navi (without having to manually add them one by one as they are created). So far I added this on my functions.php, but no ...
0
votes
1answer
29 views

List of all entries of custom-post-type: Add year-parameter?

I've once got help with the following function: function get_event_list( $latest = true, $order = 'ASC', $return = false ) { $yesterday = time() - 24*60*60; $compare = $latest ? '>' : ...
0
votes
1answer
42 views

Get post title by Alphabet

I try to call this function to get a list of posts by alphabet. But for some reason i keep getting an error. Call to a member function get_col() on a non-object. What am i doing wrong? {function ...
0
votes
0answers
28 views

create submenu page - error function not found or invalid function name

I have created a plugin with a top level page. I created a sub menu underneath that. When I run the plugin on my site everything works. But when I test it on a separate site I get an error and I'm not ...
0
votes
1answer
48 views

Translation of theme using child theme

I have created a folder called “languages” in my child theme directory and added a: da_DK.po and a da_DK.mo file generated using POedit. I have created a functions.php file in my child theme ...