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

How do I change the add to cart text on the cart page?

Im trying to change the add to cart button text to 'Complete Sale' when on the basket page, but be 'Book' elsewhere, here is my code in the fucntions file: function woo_custom_cart_button_text() { ...
-4
votes
0answers
17 views

i have a problem with the responsivity of my site [on hold]

i have a problem with a site i built www.hadran.co.il, the site looks good but in the phone it looks very bad. its go left and many more problem, can anybody can go to the page threw the phone and ...
1
vote
1answer
32 views

Check if page parent has certain template

I want to check if a page has a parent with a certain page template attached to it. If I know that I can determine which scripts to load or not. Normally I would just get the page template and if it ...
0
votes
1answer
681 views

Add content after get_header

I'd like to add content directly after the div#main (end of header.php) and before /div#main (beginning of footer.php). I'm using an own child-template (of twentythirteen), that contains only ...
2
votes
3answers
344 views

Is using eval() ok in this scenario

I am trying to include user input includes using "get_template_part()" The includes are added in the theme options eg a user inputs. get_template_part('content/block', 'branding'); ...
-1
votes
1answer
18 views

Sync roles across several plugins

Here is the setup: I am implementing Wordpress with two specific plugins: Ultimate Members and Yith Vendors which is a woocommece addon. What I need to do is change a field's data in the database ...
0
votes
0answers
22 views

Warning Error When Visiting My Site

When some people visit my eCommerce site, they get this error: This is what it keeps saying: Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'wp_widgets_init' not ...
1
vote
1answer
859 views

Auto Populate Custom Field with Complex Value That Increase by One?

Can somebody help me to sort this? I am using WP 3.5.2 and I have "Orders" post type where purchase_order custom field is located. This is the sample of purchase order record: POCOS20130051 PO - ...
0
votes
0answers
10 views

Everytime I press Save Settings from a Plugin it redirects to All Settings page

I have developed a settings page for a theme in which I'm working in order to have some options to customize it. Here are all the options and here is the functions.php. I don't know why but when I'm ...
0
votes
0answers
8 views

Create a Button alongside add to cart

i want to create a button alongwith add to cart that will perform a specific function. please tell me how to do this.Also can you tell me the css of this button so that the button looks exactly like ...
0
votes
0answers
13 views

Custom Theme Admin contact-form config page won't display

I'm stuck. I'm trying to add a contact form section in my theme admin. I have added: the functions function volcano_contact_section() { echo 'Activate and Deactivate Built-in Contact Form'; } ...
0
votes
0answers
18 views

How to protect a comment with a password?

Is there any way to Protect a comment with a password so that the comment can be seen only when the right password is entered. I know a post can be password protected , but thats not the way i want ...
0
votes
0answers
8 views

How to use wordpress (php) functions in angularjs partials files?

I am using angularjs to load a list of my wordpress posts, however I can not get any of my php functions to work with my partials file. I've tried using something such as search.php instead of ...
0
votes
0answers
13 views

Check if has any sidebar active on current page

Is possible to check if has any sidebar active on current page? Like this: @edit This function also return true even if the current page does not have this sidebar active... <?php ...
0
votes
2answers
402 views

How to create an option page for this simple plugin

I know how to write WordPress plugins but I have no idea how we could create an option page for our plugin. I have read lot of tutorials but I still have no idea about creating option pages. So just ...
1
vote
2answers
45 views

In WooCommerce I need to modify the thankyou.php page

In the thankyou.php template there is an action showing the section marked in red in the image. The problem is the caption/title "Our Bank Detals" should be above the description not beneath. The ...
3
votes
3answers
8k views

Ajax call always returns 0

I have a problem with AJAX returning 0 always! I have done everything by the book and can't figure out what is wrong? Please help!! Here is my Ajax call: //Pass data through AJAX var ...
3
votes
3answers
9k views

Limit access to posts/pages by user roles

I'm looking for a way to protect content by user roles. Example: you have to be registered to view posts (frontend). If a user is a subscriber he can read post 1, 2 and 3, but if the user is a ...
1
vote
1answer
35 views

IF Statement in Wordpress

I can't seem how to correctly use the php if statemnt in my add filter function below. This code works perfectly if all (3) of my $_POST inputs have values however it has a fatal error if any are ...
0
votes
0answers
26 views

Entire site breaks when error in a php file because of multiple get_template_part in functions.php

I bought a WordPress template and I'm modifying it to fulfill my needs, But I have a problem. Whenever I there is an error in one PHP file, the entire site (including the homepage) breaks. I see that ...
0
votes
1answer
1k views

How to echo Widget Title in Custom Frontend-Template Box

I've created a custom Widget with the help of following code: // Creating the widget class wpb_widget extends WP_Widget { function __construct() { parent::__construct( // Base ID of ...
0
votes
1answer
2k views

Let users upload image(s) to the post from front end

I want to enable logged in users (Wordpress) to submit posts from front end (among with other data). My form is working great, I add custom post meta data which I later display on custom post page. ...
0
votes
2answers
529 views

Show the post date using the wp_get_archives() function?

I have some doubt about the wp_get_archives() function In my website I have create the following page template that use the wp_get_archives() function to show the posts list: <?php /** ...
0
votes
1answer
399 views

How can I customize the size of the header of my theme?

I want to change the size of my header using the Sparkling theme. In functions.php, right below this: /** * Implement the Custom Header feature. */ I added this: add_theme_support( ...
3
votes
1answer
769 views

Remote upload file to server B

I'm aware this might be some of the hardest coding to do ever, but thought of giving it a try. Im basically trying to detect all (mp3) filetypes uploaded through the Wordpress media upload and send ...
0
votes
0answers
22 views

Function returning same value for all posts

I have this function to get the size in KB from a file. It works like a charm as long as it's on a single post. However, if I do a query, all posts take the value from the first post. Thus, if the ...
0
votes
1answer
18 views

Displaying text if post was within 5 hours

Currently I have the following string. $timeago = human_time_diff( get_the_time('U'), current_time('timestamp') ); print $timeago; This returns results that looks like this. 1 min, 1 hour, 1 week, ...
4
votes
1answer
36 views

Paged Single Post doesn't redirect to the main url after Removing Pagination

I used <!--nextpage--> (Codex) to paginate (split) a few single posts. Now i removed all the nextpage html parts from the posts. everthing looks fine. Unfortunately the old urls like ...
0
votes
1answer
455 views

Custom wp_trim_words() function not trimming right

I have this custom wp_trim_words() function set to give me excerpts of only 20 words, and for the most part, it works fine. Except for some reason, on posts that contain lists, it outputs way more ...
0
votes
0answers
37 views

Custom WP Admin pages do not display after trying to add child to functions-admin.php

I am building a theme options page. I have a parent page with 3 sub-pages under that. Volcano (Parent) Sidebar Theme Options Custom CSS The Problem: All of these settings are not displaying at ...
0
votes
0answers
18 views

Javascript attr href not appending parameters on WordPress site

I have this exact code set up and running on a regular HTML/PHP site but when I tried setting it up in WordPress, it doesn't work. The code itself works, the Javascript is present when I view the ...
1
vote
5answers
3k views

How to check if a user exists by a given id

Is there any way to check if a user id exists? I want to create a function similar to username_exists() but which returns if the id exists or not.
0
votes
0answers
245 views

automatically adding submenu items

Here's the solution that @bainternet has posted here: Add child pages automatically to nav menu /** * auto_child_page_menu * * class to add top level page menu items all child pages on the fly * ...
0
votes
2answers
812 views

AJAX values converted to PHP Variables?

I just started playing with Wordpress and I have a question about the AJAX side of things. I think that I understand how the AJAX front-end to server side processing, back to font-end works. But, I ...
0
votes
0answers
15 views

add_menu_page and URL parameter

It is possible in WordPress to add a url parameter to the add_menu_page slug? Only found solutions for a submenu page. Odd thing is that if i add a node to the admin bar which has the link ...
1
vote
2answers
27 views

Change size and crop medium_large images

I use events manager pro plugin to show an eventslist. These event-list is showing their thumbnail image in the new (wordpress 4.4) wordpress image size "medium_large" (width 768px). I need an image ...
27
votes
4answers
40k views

Changing Admin Menu Labels

I have spent the last day using the functions.php file to fully customize WordPress for my client sites. I am amazed at how much I have been able to accomplish and how much easier it will make things ...
2
votes
1answer
65 views

woocommerce change currency per category

I am trying to display a different currency on a specific category within my Woocommerce store. Specifically, this category is full of items that can only be purchased through myCred points. The rest ...
0
votes
1answer
943 views

Session is not starting

I've read the usage of session() in WordPress from here and here. And I placed the following code into the very starting of my functions.php: /** * ENABLING SESSION TO THE SITE * Thanks: Shazzad ...
-1
votes
0answers
17 views

Modify (functions) code that inserts ads (or whatever else)

I use the following code in functions.php to insert an ad after the second paragraph. I would like to continue to do this, but also add another (different) ad before the last paragraph. How do you ...
0
votes
0answers
20 views

Enable/disable code in functions.php with options

Is there a way to enable or disable lines of code in a themes functions.php file? Basically I would like to have a page in the admin panel that lists "modules" or separate php files and has the ...
0
votes
2answers
42 views

How do I correct the code in php? [closed]

I am new to PHP and I'm unable to solve the code. It's showing an error. <?php function thumbImg() { if ( has_post_thumbnail() ) { the_post_thumbnail( array(54,54) ); } else { ...
3
votes
1answer
33 views

Add options to featured image

I want to add an option to the featured image metabox. I have found a way to do this here The problem I'm having is saving the value tot the database. Here is what I have tried: add_filter( ...
-2
votes
0answers
16 views

How to get Fpdf,html2pdf or Dompdf get work in Wordpress custom template?

Im working on a project to let html input change into a pdf file. I know that are these working pdf programms, but how do i put it in Wordpress and let it work in there?
1
vote
1answer
28 views

Creating loop within functions.php

I'm using Woocommerce on my website, on the checkout page I've got a custom select checkout field with radio buttons. I'm using this working snippet within my functions.php: /** * Add the field to ...
1
vote
1answer
29 views

How do I remove the date and category form my portfolio pages

This is one of my portfolio page Whenever I wanted to remove dates and category from blog posts I always used this code function jl_remove_post_dates() { add_filter('the_date', ...
1
vote
0answers
11 views

Adding a widget function into the php theme file

I am using the following plugin - widget No Cache AJAX Widgets to display on the sidebar a feed of rss news that is created dynamically and bypassing the cache function. In updating the site we wish ...
3
votes
1answer
29 views

Wrap each shortcode in array to div

i'm trying to wrap each shortcode in div with special data attributes, but when i'm using nested shortcode they don't wrapped, where i'm wrong? thanks public function wrapShortcode( $content ) { ...
0
votes
1answer
29 views

Woocommerce checkout field maxlength, make input number field only (postcode)

I've been struggling with this for a few days now. What i want to do, it to limit the Postcode/zip fields to 4 numbers. So, to add a maxlength and a type="number" to those fields. Things i've tried ...
0
votes
5answers
227 views

How to run a function every 5 minutes?

I have a function to be run every 5 minutes. I've referred following from the codex: <?php wp_schedule_event(time(), 'hourly', 'my_schedule_hook', $args); ?> I want to run this function just ...