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)

4
votes
4answers
253 views

Should I write a PHP function in home.php?

I am trying to learn WP Theme development. And as I have understod all "wp core" functions should be placed inside functions.php. But what about custom functions? Lets say I would need a simple ...
1
vote
1answer
18 views

Define Function in functions.php or plugin and call in theme loop

I need to define a function in functions.php or a plugin and be able to call it inside the theme's loop & outside. Example; I have a $product_price = get_post_meta(get_the_ID(), 'product-price', ...
0
votes
0answers
7 views

Get stock from another store for a WooCommerce store

I want a help! I am reseller of other stores, and as the store grows it becomes hard to manually update inventory. I have a custom field _url_font that I fill with product source address. I wanted ...
0
votes
1answer
12 views

Showing content from one page on another

There are many posts that seem to strike around this area, but I'm more and more confused by each one I read. I have a page that shows the "Terms of Service" (id = 1772). I would like to display the ...
-1
votes
0answers
14 views

Is there a way that you can use 2 same wordpress plugin at the same time?

Is there a way that you can use 2 same wordpress plugin at the same time? like using 2 jetpacks or 2 any other plugins?
0
votes
0answers
25 views

Rewrite rules lead to blank page

Using a child theme, with custom post type article, trying to call a file from functions folder inside the child theme main folder (child-theme/functions), using this code in the child theme ...
-1
votes
0answers
26 views

How to add repeater field to option page?

I've created an options page for blog. In this options page, I can save some details about the website. using this code: add_action( 'admin_menu', 'site_add_admin_menu' ); function ...
0
votes
0answers
19 views

How to wp_enqueue_script with html?

I want to wp_enqueue_script multiple javascript with html and css. I place the html code in a page, but it's not working on my side. Only plain text is displayed. Here's the link: ...
0
votes
1answer
26 views

add a function code into a class name [on hold]

how can I hook or add action or add filter this code into the class name by using function code: function user_authorname_qv() { echo "<p class='qv_authorname'>"; echo get_the_author(); ...
0
votes
0answers
6 views

How to override class of theme in child theme aka get google latin ext fonts

I have bougth a premium theme at ThemeForest but nobody has answered to my question - they are using Google fonts in the theme, but unfortunately, without latin extended characters and I have no clue ...
0
votes
0answers
9 views

How do you get all the posts and generate a table automatically in page?

I am trying to make a page with all the interesting posts(tagged with "interesting") and make a searchable table using TablePress. First of all, is this possible? If so, 1) what is a function in ...
0
votes
1answer
17 views

Automatically add tag if a checkbox is checked

I'm looking for a simple function to automatically add a specific tag to a post if a checkbox is checked. For example: When creating a post there is a checkbox that says: "Add example tag to post" ...
0
votes
1answer
18 views

How to style injected code in header section?

Trying to add custom code to header section <head>..</head>of the blog by adding this code to child-theme functions.php // Add scripts to wp_head() function child_theme_head_script() { ...
1
vote
1answer
14 views

Where can i find wordpress auto update code flows?

I want to see how WordPress auto update works in code . which WordPress file or function performs auto core update? I have read http://halfelf.org/2011/how-the-wordpress-upgrade-works/ I have ...
0
votes
0answers
5 views

Convert NOBLOGREDIRECT to use 301 instead of 302

Does anyone knows any process to convert the NOBLOGREDIRECT 302 conversion to 301 for WP MU sites? When you define the NOBLOGREDIRECT value to some url, it uses 302 to redirect to that url. I want it ...
0
votes
1answer
17 views

Remove links from the_content when using filters wp_trim_excerpt

I'm using wp_trim_excerpt which is working perfectly but I want to strip the links contained in the the_excerpt (using get_the_content), I've looked online and tried many solutions to get the thing to ...
1
vote
1answer
31 views

How to override a plugin function wrapped in a class?

The class is from someone else's WP plugin and I want to adapt one of the functions from that class (there are more functions). The (edited) original code: class some_class { private function ...
1
vote
1answer
28 views

creating shortcode to pull json array

Frankly - this may be a duplicate of another question I have out there. Sorry if it is. I'm learning this site and PHP/Wordpress development. I have partnerships with local sites that use JSON and ...
0
votes
0answers
25 views

Is there a hack for using is_page() within the function.php file?

I've created a function in my functions.php that's called when the submit_form event is fired on the front-end. Here is the code: add_action( "wp_ajax_nopriv_submit_form", "submit_my_form" ); ...
0
votes
2answers
37 views

Database SQL Error, Should Work

I'm trying to get my posts to order by radius, and so far i'm struggling, I've been using the following tut by Steve MArks, http://biostall.com/performing-a-radial-search-with-wp_query-in-wordpress ...
0
votes
1answer
25 views

How to style options page in dashboard?

working with a child-theme, adding a custom options page to dashboard in which admin can save details about the site. Using this code in the child-theme functions.php to create the options page: ...
1
vote
2answers
29 views

Access Plugin data from Functions.php

I'm trying to insert data from a wordpress post into a new table database table rather than WP_postmeta. My function is working, It'll insert the $postid no problem at all. The issues I'm having is I ...
0
votes
0answers
20 views

Problem creating menu shortcodes

I'm trying to setup three shortcodes, each to display its own unique menu block. Just two are shown in the code below because I ran into an issue. The problem I am having is that both [footera] and ...
0
votes
1answer
20 views

How to use parent theme functions in child theme functions.php file?

Parent theme required a foo.php file, and inside that file is a baz() function. I want to use that baz() function in functions.php of the child theme without recall foo.php file again. Are there any ...
0
votes
0answers
13 views

Empty categories not showing up with custom function

I'm working on a WordPress based website, and I have three levels of categories. Something like: Category 1 Child 1-1 Grandchild 1-1 Grandchild 1-2 Grandchild 1-3 Child 1-2 ...
0
votes
1answer
38 views

Database Query not working

I've been following a tutorial by Steve Marks which goes throught adding information from posts to a new Database Table as well as the usual postmeta one. However no matter what I try, It will not ...
3
votes
1answer
39 views

How to create a custom order status in woocommerce!

I've tried the below code to create custom status. add_action( 'init', function() { $term = get_term_by( 'name', 'shipped', 'shop_order_status' ); if ( ! $term ) { wp_insert_term( ...
0
votes
0answers
14 views

Manipulating DevBuddy Twitter plugin

I'd like to manipulate the DevBuddy Twitter plugin, to change the order of divs inside .tweet_content. I would like .tweet_media to come before .tweet_profile_img for the sake of my layout. I had ...
0
votes
0answers
33 views

Woocomerce adding items to cart from a share cart url? [on hold]

I think I need help in here, Im not really sure if I need to set the session manually or it will set automatically while adding items to woocommerce cart, lets consider the following: ...
0
votes
1answer
19 views

Page not showing after add a function on child theme [closed]

I am using Genesis framework and modern-studio-pro as a child theme. I have just copy this code function genesis_standard_loop() { //* Use old loop hook structure if not supporting HTML5 if ( ! ...
0
votes
1answer
32 views

How to create “page” used for generating PDF? [closed]

I am new to wordpress but I do have some knowledge base in php. I am developing custom theme for my Wordpress site. I also have a PHP file which generates PDF file based on GET parameters and it's ...
0
votes
2answers
23 views

Query for user roles

How do I query for a specific user role? if (is_user_logged_in() && user_role == "user") {} The part I'm unsure about is user_role. Is there a way I can ask WordPress to check for a ...
0
votes
2answers
8 views

use system script advertising in wordpress multisite

I have a little problem that I can not solve. I have a website "multi-site" system with ADS script. I wish I could enter leaderboard banner. This is an example script: <div id=""><script ...
1
vote
2answers
261 views

Pass info from functions.php to plugin

What is the best way to pass some information from functions.php to a plugin? I need to give a user the ability to pass a piece of data from their functions.php file to my plugin. (It can be any ...
0
votes
0answers
7 views

Only show loged-in user's post on WP Calander

WP default, the calendar shows links on the dates have post through out the entire site. I want to make it only show the ones from the logged in users. I'm hacking general-template.php to do that now ...
1
vote
1answer
46 views

Display Password Protected external RSS in wordpress template

I am using the below code to show external rss feed in my wordpress blog page template: <?php include_once(ABSPATH . WPINC . '/rss.php'); $rss = ...
-2
votes
1answer
23 views

Undefined variable notice [closed]

function custom_content_filter_the_content( $content ) { $colorsList = array( 'Baby Blue' => "66CCFF", 'Beige' => "CC9966", 'Black' => "000000", 'Blue' => "0000CC", ...
0
votes
0answers
12 views

How to update post meta in schedule event action-function?

I want to execute something like this. What I must to change in following code? wp_schedule_event( time(), 'hourly', $string); add_action($string, 'do_this_hourly'); function do_this_hourly() { ...
0
votes
1answer
13 views

call_user_func_array() error after moving to another server

I've just moved my WP site from one server to another and my custom post type plugin is causing the following error: Warning: call_user_func_array() expects parameter 1 to be a valid callback, ...
1
vote
2answers
39 views

Hide old attachments from wp media library

I am trying to limit the files that are shown in the wordpress media library popup (from wp_editor). Currently every single file that I have ever uploaded to my site is shown in the library but I ...
0
votes
0answers
17 views

Been at this for hours--how do I add a jQuery function in the functions.php of WordPress?

I can't include all the things I need to include in my one multi page gravity forms form. If I try to include too much it just 403 errors me. I need to add a video at the top of each page. I've spent ...
-1
votes
1answer
18 views

Link to external page has wordpress blog-url inside

I am modifying a theme. The initial function looked like that function tmnf_ratingbar() { $rinter = get_post_meta(get_the_ID(), 'tmnf_rating_main', true); if ($rinter > 0) { ...
0
votes
0answers
30 views

WordPress Caching

I try something on my local machine. I have a custom JS and CSS file which I included in the functions.php of my theme (twenty fifteen) like this: function load_my_stuff() { wp_enqueue_script( ...
-1
votes
1answer
22 views

WP Members additional fields on user profile

i want to have a limited set of fields during the registration process, but would still like additional fields available for the user to complete in the user profile.these are not required fields. as ...
1
vote
1answer
31 views

How does Wordpress process plugin installations?

Please consider that I am not a Wordpress plugin developer, but I am maintaining a lot of Wordpress websites. In case I have to perform a change to all of them, I will have to log in each site and ...
0
votes
0answers
20 views

Declare inline background image in functions.php

I'm not sure if this can be done as I cannot find anything to help me anywhere no matter how hard i try. I'm using Ajax to load to in posts on the press of the button. the posts that are loaded in are ...
0
votes
1answer
54 views

Is the “_s” on this `sprintf(__('Page %s', '_s'), max($paged, $page))` just refer to a text domain?

Is the '_s' value in such code which can be found on Customizing with the filter, just refer to a string of a text domain as what's documented or a literal value? /** * Filters wp_title to print a ...
4
votes
1answer
124 views

Keep one user logged for a year?

This has got to be simple: how do I keep one user - my-user - logged in for a year? (I'm checking logged in cookies in the dev tools console). Update 8/16/15 This works: add_filter( ...
0
votes
0answers
15 views

How to call the post thumbnails in a list of recent post in wp nav menu?

Thanks to Stack I found a code which allow to list recents posts of each of my categories into my wp nav menu. The code looks like this : // Front end only, don't hack on the settings page if ( ...
0
votes
0answers
33 views

Modify category archive page loop on functions.php

I was able to modify the query on the category archive page using global $wp_query; $args = array_merge( $wp_query->query_vars, array( 'tax_query' => array( array( ...