Tagged Questions

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

Retrieve post modified date for specific post by post ID

I am looking to use the 'the_modified_date' function to display the date and time of a specific post has been modified. This information will appear in the header of our website on every single page. ...
0
votes
0answers
5 views

Settings in functions.php used by a plugin

I'm writing a simple plugin and want some settings in an array in the functions.php file. I'm thinking of adding this in the theme functions.php $test = array('haha' => 'hehe'); my_function( ...
0
votes
0answers
24 views

How to make a plugin theme-wide?

I have written a working plugin and meets the criteria. Although I've encountered an issue, I've noticed that it's only usable on the theme's functions.php that I write the function and specify the ...
0
votes
1answer
18 views

Ajax call theme functions from front

Here's what I try to do : calling a function in my theme functions.php from the front of my theme. So, on the front : $(document).on('click','.btn-vote',function(e){ ...
1
vote
3answers
65 views

Rewrite Question Mark in Post Template with URL Parameter for clean URLs

I use following code (Source) to change the single post template via url parameter: function sjc_add_query_vars($vars) { return array('template') + $vars; } add_filter('query_vars', ...
0
votes
1answer
19 views

Creating customized php files in theme folder

I am developing a e-commerce theme that requires an order page. I created a php file inside my theme folder named order-page.php and hope to access this page from the wordpress root url ...
0
votes
1answer
11 views

Format latest/newest post differently

I need to apply different formatting to only the latest/newest post. I need the first post to be full size image and full post, all subsequent posts must be excerpts with thumbnails. The code I am ...
1
vote
2answers
29 views

Fatal error: Class not found in

I am working on a plugin for 'hooking' an extra payment provider into a checkout system. I have a class gtpCheckoutData in my function.php which calculates the prices. In my plugin I want to use ...
0
votes
0answers
22 views

setcookie in functions.php does not accept arguments (variables) passed from WordPress page

I have a WordPress installation where a page (Page 1) displays certain fields from a selected user's profile (Not the logged in user but a user they have selected). A PayPal button is used to take a ...
1
vote
1answer
17 views

Set the background to a default image if there isn't a specified “featured image”

I am having a little trouble displaying a default image as a background image when a feature image is not present. This is the code I am using <?php if (has_post_thumbnail( $post->ID ) ): ...
0
votes
1answer
17 views

Remove heading tags on line break

I have to add line breaks in a h1 paragraph using the visual editor. On every line break Wordpress automatically adds h1 tags to every new line. Example: <h1>Watsup</h1> ...
0
votes
0answers
35 views

wp_enqueue_script, no output, no error [on hold]

I am working on a remote server, I do not have access to my php.ini file The problem is that I receive no output from the results of this function whatsoever on my outputted page which can be seen ...
1
vote
1answer
47 views

Remove function or filter

Im working with a child-theme of Wordpress-Bootstrap by 320press.com I want to get rid of the lead class added to the first paragraph of the content. I looked in Wordpress codex in these articles: ...
-1
votes
0answers
17 views

Woocommerce - free shipping to the continental US for a specific product? [closed]

I've built an ecommerce site for a client over the summer using Woocommerce, but I would still consider myself a beginner when it comes to PHP and the backend of WordPress. I'm trying to accomplish ...
0
votes
2answers
31 views

How do I pull avatar from post using BuddyPress? [on hold]

I'd like to pull the avatar of a blog post's author and display it on the page using BuddyPress but I cannot seem to pull it off. How would I go about this?
0
votes
0answers
21 views

Display a post based on its metabox selection

I created a client portal where a client can view their projects. I have two user accounts "Clients" and "Administrator. Both clients and administrator are redirected to the frontend of the site to a ...
0
votes
0answers
14 views

Theme Customizer Boilerplate Sanitization Problem [closed]

My question is related to this plugin I have problem with a required setting with the wordpress theme check plugin, this is the error that I get: REQUIRED: Found a Customizer setting that did not ...
0
votes
0answers
21 views

Use own function in header.php [on hold]

I want to add a function located in functions.php to my theme, that looks like this: function if_wide() { global $post; if (get_post_meta($post->ID, 'cbLayout', true) == 'Wide') { ...
3
votes
2answers
62 views

Is there a hook or function I can use to display all theme files being used on a current page?

Basically I want to be able to see the names of files on the front-end - not just templates e.g. category/page templates, but the actual theme files like header.php/sidebar.php/footer.php and so on. ...
0
votes
1answer
24 views

Wordpress Javascript Widget jQuery Dependency Issue

I am using a local clean install of WP 4.0 en_GB with no plugins. I have been provided with some information to implement a JS widget into my website. <div id="login"></div> <script ...
0
votes
1answer
22 views

Return child theme url

I'm trying to return the child theme url for a child theme favicon. The official code to use in this case is: //* Display a custom favicon add_filter( 'genesis_pre_load_favicon', 'sp_favicon_filter' ...
0
votes
0answers
17 views

How to build shortcode for tabs

i made a tabbed widget to display recent post , comments, and popular posts, but now i want to take out tab function from this and make a shortcode of it, so i can add it to wp posts and use it there. ...
0
votes
0answers
24 views

wp_upload_bits - define (sub)folder / (sub)directory before filename?

I have this code for a plugin I'm using. $comment_image_file = wp_upload_bits( $title . $user->user_login . $comment_id . '.' . $file_ext, null, file_get_contents( $_FILES[ $comment_image_id ...
1
vote
2answers
39 views

How would I add “edit profile” and “blog post” functions to front-end?

I'm rather new to Wordpress and I've been looking around for an hour and a bit but cannot find what I'm looking for. I want to add an "edit profile" button to the author page so the user can edit ...
0
votes
1answer
35 views

wp_star_rating() - Adding a 5 star rating system to theme

My goal is to add a 5 star rating system to my theme. I read that there's a function wp_star_rating in wp-admin/includes/template.php on line 2121, that I've been trying to use for the ratings. I am ...
0
votes
1answer
41 views

writing an unique php function to be used on my website

I'm using a custom php code to translate my date format on my wordpress website, using get_the_time. I have to use this code on various spaces on my website, sometimes more than one time on a page. ...
0
votes
1answer
16 views

Accepted arguments value in hook functions

Let's say I have the following hook function: function my_function() { $post_type = isset( $_GET['post_type'] ) ? $_GET['post_type'] : ''; if( !isset( $_REQUEST['mode'] ) ) $_REQUEST['mode'] ...
0
votes
0answers
19 views

Dynamic multi column menu

I have a dynamic menu where the submenu is based on specific content from the page. With help from Uruk on the this thread We(he) made it work. What I realise now is that if a page contains a lot of ...
0
votes
2answers
48 views

Modify function to only return values for the user that’s logged in

I'm trying to modify a function in a plugin so that it only returns the custom post type (venues) of the user that’s logged in (by default it displays all venues). This is my first time customizing a ...
0
votes
2answers
20 views

Custom meta box in custom post type not working

As a wordpress newbie I am having problems in adding custom meta box in my "slider" custom post type which I used in some old wp theme. I'm getting a warning: Warning: call_user_func() expects ...
0
votes
2answers
44 views

Problem enqueuing scripts on not single posts

I have this code to enqueue a script file when the page is not single.php (neither admin page): //functions.php /********************** Add JS file **************************/ function ...
0
votes
0answers
12 views

Remove DEFAULT POSTS (not custom ones) in admin panel

I am trying to hide the post link in the menu in the admin panel, my code is the following. Any idea what might be wrong? I added that string at then end of my functions file. Thanks a dozen! ...
1
vote
2answers
49 views

How to override WordPress registration and insert an auto-generated username?

I need to auto-generate usernames upon WordPress registration. I have a custom registration form set up and would like to create the username in functions.php. Can someone tell me why this isn't ...
0
votes
1answer
20 views

Query custom post type and showing its content

I am a newbie in developing wp themes and having troubles showing my cpt. I added new cpt in my functions.php file: // Creates Testimonials Custom Post Type function testimonials_init() { $args ...
0
votes
0answers
15 views

How to add automatic remove links/href from image for wordpress post

I have in the function.php own css style but I need to remove links automatic add_filter('the_content', 'add_image_responsive_class'); function add_image_responsive_class($content) { global ...
0
votes
1answer
17 views

Wordpress performance - send all metaboxes to function or to call it again

I need to send my metabox information to a function - the meta is already called on page template $meta = get_post_meta(get_the_ID()) but I need to use this data in function the metaboxes are ...
0
votes
0answers
23 views

How to remove a require in parent theme from a child theme?

In the parent theme I have in functions.php require_once( get_template_directory() . '/inc/customized-css.php');?/ Generated css I however what to remove this php in my child theme, how I ...
1
vote
1answer
21 views

Commenter should see only his comments in wordpress

I'm building a site for a research and my participants will be all logged in to use the site. I would like to make these participants able to see only their own comments, so other users' comments will ...
0
votes
0answers
44 views

PHP version or config prohibiting script from working properly

I have a function that is working correctly on another site, but not on mine (the string is not being replaced on my site). Both sites are using the default 2012 WP theme and the same plugins. I'm ...
0
votes
2answers
58 views

Passing variable as add_shortcode argument

I'm trying to pass a variable into the add_shortcode function to be used as the shortcode name but it does not seem to be working. Is there a way that I can pass a variable similar to this? foreach ...
0
votes
0answers
42 views

Automatically add custom fields (post_meta) to all published posts, hourly, via wp_cron?

I'm trying to update the post meta of all published posts hourly (via wp_cron) with the code below: if ( ! wp_next_scheduled( 'postviews_updatedcounts_hourly_event' ) ) { wp_schedule_event( ...
0
votes
1answer
59 views

Got white blank page after copying the functions.php to child theme

I got white blank page after copying the functions.php to my child theme. How can I change "like_escape"? What file can I find that? And I see this notice: Notice: like_escape is deprecated since ...
0
votes
0answers
30 views

how to load post content when a post title is hovered using ajax

i have a wordpress blog and i need to make my posts content show up when vistor hover the title of the post on my index page with no need to get into that post , exactlly like in the following site : ...
0
votes
2answers
36 views

is_page Funtion for Posts ?

I am using a plugin Bottom of every post which have a a function if( !is_page( ) && file_exists( $fileName )){ which is printing custom Text on bottom of every pages, i want to show them on ...
0
votes
0answers
21 views

Link to existing content is not working

it's pretty simple, I have a fresh local installation of latest wordpress with the reverie there/framework. Everything is working smooth, but the nice ajax feature in the editor (Link to existing ...
1
vote
1answer
69 views

Get the title before comma

I am using this code to return the title of the post on a gravity form field. add_filter('gform_field_value_page_name', 'page_name_filler'); function page_name_filler($value){ return ...
0
votes
1answer
20 views

Apply height and width for the_content() inside youtube video tag

I am displaying video and content form this function the_content() for this am using you-tube [embed] link. How can i give height and width ??? Also, I am using the_post_thumbnail() for image it to ...
0
votes
1answer
32 views

Function to display post by specific author

I am trying to create a function that will display the 5 post made by a specific author. Lets say the specific name of the Author is 'Nick' I don't know how to excute it. I am using global variables ...
0
votes
1answer
33 views

How to display 2 function calls in same line?

<?php the_author_posts_link(); ?> <?php the_time('g:i a'); ?> When I call above 2 functions you will see the output in two lines. But what Need is "Andrew 2.10" I need both output in ...
0
votes
1answer
70 views

How to override woocommerce.css?

I would like to override woocommerce.css in my child theme. This is what I tried in my child theme's functions.php but it does not seem to work: add_filter( 'woocommerce_enqueue_styles', ...