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

How to add custom redirect via parse request

I want to add custom redirect: Please tell one liner code to do : 301 redirect, 307 redirect, meta, javascript; add_action('parse_request', 'my_custom_url_handler'); function ...
0
votes
1answer
19 views

How to register a menu based on a ACF condition

I am trying to register a Wordpress menu, depending on a ACF field condition. $logo = get_field('logo','options'); if ($logo) { register_nav_menus(array( 'brand_centered_left' => __('Brand ...
6
votes
5answers
165 views

Best way of passing PHP variable between partials?

I have a variable in header.php, such as: $page_extra_title = get_post_meta($this_page->ID, "_theme_extra_title", true); Once I do: var_dump($page_extra_title); I always get NULL outside of ...
0
votes
1answer
312 views

call wp_insert_user in custom class doesnt work

im creating a custom class to manage users in wordpress and chamilo but this is not the point. Class looks like this: class Platform { private $security_key = '..'; private $secret_key; ...
1
vote
1answer
20 views

Add get_option to jquery

I have created a settings page that contains various radio button options for a custom plugin. A radio button I've created is to 'display dots' with the values yes or no. I can get use the value any ...
-2
votes
0answers
17 views

WooCommerce - How can I hook into product variation select to show dynamic content for each variation? [on hold]

my site runs Wordpress + WooCommerce and I have put together a simple plugin which I am using in my sidebar to run the standard [product_category category=""] shortcode, with get_post_meta to retrieve ...
0
votes
0answers
25 views

How can I add recent posts to menu like mashable

I would like create a mega menu that uses recent posts for hover state. Like When you hover a submenu you get a list of recent post relevant to that menu item like in Mashable. I I would like a menu ...
0
votes
1answer
44 views

What is wrong with functions.php? Fills error log with same error

After a third-party developer was used to reconnect our calendar with the Google Calendar API 3, we found that our .../wp_admin/error_log infinitely wrote: [14-Apr-2015 11:46:59 America/New_York] ...
1
vote
2answers
347 views

Custom gallery in wp3.5

I used a tutorial I found for a slick little custom gallery in 3.4, but upon upgrade to 3.5 it no longer works. I'm trying to learn php still and can't seem to get this working again, as I either get ...
1
vote
1answer
3k views

How can I customize wp_footer, where is the code that controls what this function does?

I am using Wordpress 2013 theme as a starting point for a new theme from scratch. Under my themes folder, my footer.php theme looks like this. (Notice the final functionwp_footer(). ...
4
votes
5answers
5k views

Relative URLs and hide /wp-content/themes/

in my header and other sections I would like to use <script src="/incs/js/script.js"></script> While maintaining the default theme folder structure in server as below ...
0
votes
0answers
74 views

function get_page_permastruct() on a non-object

global $user_ID; $page['post_type'] = 'page'; $page['post_content'] = "Hello world"; $page['post_parent'] = 0; $page['post_author'] = $user_ID; $page['post_status'] = ...
0
votes
0answers
7 views

Detach “Add to Button” from amount specifier [on hold]

Hello I'm having trouble with my "ADD TO CART" button positioning on my wordpress page. As you can see from the picture below the button is placed under the amount specifier. I have tried using ...
0
votes
1answer
19 views

Function returning queried meta value based on current post ID

I have written several queries which sums download counts grouped by the post they are associated with, and other relations. They work great for exporting to CSV and other uses outside of WordPress, ...
0
votes
1answer
892 views

How to access global variable $menu inside a class function

am puzzling why can't i access the global variable $menu inside a php class function class adminMenus { public function getWPdefaultmenus(){ global $menu; return $menu; } } using ...
0
votes
1answer
366 views

Custom attributes to javascript tags

My site uses cloudflare but I really want to enable rocket loader, but if I put it on automatic mode, it messes up my whole site... So I googled and found This answer which has helped in terms of ...
-3
votes
0answers
16 views

How to change wordpress default search without plugin [on hold]

how can i display wordpress search results based on user input, users input are from and to dates from the datepicker.
0
votes
1answer
30 views

Conditional read more adjustment

I get the read more link like this <?php the_content("Read More"); ?> I want on the Homepage a different text than on an archive pages. I can change the text for all read more links in ...
0
votes
1answer
32 views

Wordpress get_post_meta issue

I'm new to php and was assigned some code to fix within a Wordpress theme, but I cannot figure it out for anything. The code is for the home page of a custom theme and it is supposed to pull the most ...
0
votes
2answers
21 views

Generating dynamic css into custom file [closed]

This is about running code on wordpress . The given code runs properly outside wordpress but when I put it on theme functions file it does not do anything. ob_start(); require('dynamic-css.php'); ...
1
vote
1answer
114 views

Understanding and altering the structure of posted images

Currently this is the (default) Wordpress image output: Float left, with caption, link to img <figure id="attachment_10220" style="width: 167px;" class="wp-caption alignleft"> <a ...
0
votes
1answer
35 views

Woocommerce Price Text

I'm trying to show after the price of my product, whether the price is 'per person' or 'per group'. I've created a custom field for both, so for example, if custom field 'price_per_person' is ticked, ...
0
votes
1answer
25 views

How to fix blank pagination links?

I am working on a Wordpress blog that has what appears to be custom pagination for the posts. As you can see here the correct amount of links are being rendered at the bottom of the page, however ...
0
votes
2answers
244 views

Can I show also the post date using the wp_get_archives() function?

I am pretty new in WordPress theme development and I have some doubt about the wp_get_archives() function: http://codex.wordpress.org/Function_Reference/wp_get_archives In my website I have create ...
0
votes
1answer
325 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
0answers
8 views

Running wp_schedule_single_event on Post Import

I'm trying to have a category deleted after a certain length of time once a post has been published. I was successful in doing this when a post is manually created, but I cannot for the life of me ...
0
votes
1answer
13 views

get_template_directory() - references parent theme directory

I've got this line in the functions.php of my Child theme: require ( get_template_directory() . '/somecode.php' ); However it's giving me the following error: Fatal error: require(): Failed ...
0
votes
0answers
28 views

AJAX login without a plugin does not work. when add a action to function.php

I am using wordpress ajax login without a plugin. I want to not be allowed users access to the WordPress profile after login, Because i have designed a specific profile in the link: ...
0
votes
0answers
24 views

ACF : Add custom field class to posts on home? [closed]

With the plugin Advanced Custom Fields i have made a custom field where i have the possibility to choose between 3 options, i would like to style the posts differently on my homepage in fonction of ...
0
votes
1answer
13 views

Writing editor content to a file

I have a project I'm working on where I need to write the content of the post editor to a physical file on the web server when a post is saved or updated. I'll be parsing and manipulating the content ...
0
votes
0answers
6 views

How to fix the warning shortcode function generated by Theme Check? [duplicate]

I searched on the internet but I still don't know how to fix it. I solved most of the the errors in WordPress Theme I am developing except for one WARNING. Please refer on complete error lines below: ...
0
votes
0answers
21 views

Create csv file in plugin

I have written a function to create csv file usin the below code.I am getting Headers already sent warning and I can't able to create the csv file too.How can I fix this problem.I have attached the ...
0
votes
2answers
33 views

Adding and updating repeating custom field meta data

I've got 20+ hours into this and could really use some help. Here is what I am trying to do.. For each record, add post meta. If the post meta already exists, update each field in the array. Just like ...
0
votes
0answers
18 views

Getting current user option within a function

I have created a new true/false field for specific user role "Member" to receive email notifications if a new post is published. For reference I'm using advanced custom fields to create a true/false ...
0
votes
1answer
27 views

Featured Image field not appearing in Custom post type

I created CPT called "Basics", then added the following code to functions.php add_theme_support('post-thumbnails'); add_image_size('large_thumb', 900, 500, true); add_image_size('small_thumb', ...
0
votes
1answer
30 views

widgets not working

I pasted my siderbar widget code in widgets.php file function right_sidebar_widget() { register_sidebar( array( 'name' => 'Right Siderbar', 'id' => 'right-siderbar', ...
-1
votes
1answer
20 views

trouble with passing class method data to outside function

I'm attempting to call a function using this shortcode format: [priceguide file='test.csv' type='mods'] When I do this, all I get back on the page is the file name, test.csv, and nothing else. ...
0
votes
1answer
350 views

Linking Javascript in functions.php file

Below is my raw javascript embeds from my html template. But I cannnot figure out exactly how to add it to my functions.php file. It seems pretty difficult. Can you please assist with the correct ...
0
votes
1answer
26 views

List all post title in category using functions.php

I have search all google about this. But many of theme show the way to make a new Template Page which you can choose template type for page. But i want it directly show post title in category by ...
1
vote
1answer
831 views

Using PHP to toggle stylesheet and header image, set in cookie

I haven't done a lot of work with cookies or Wordpress before so I think I've been a bit over-optimistic in my quest :p I have created two themes for my site, night and day. I would like the user to ...
0
votes
1answer
1k 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
0answers
27 views

Dynamically changing menu item link

Hoping someone can help me out - this has been driving me nuts for the past two hours. I'm trying to create a menu item - the menu URL should basically be: http://thesite.com/author/%username% ...
0
votes
2answers
79 views

Extract and display user infromation on an automatically created page

Is there a way to get the block of code below to extract a list of given user information as it creates the page for the new user. It creates new page for new user as supposed but I'd like it to alos ...
0
votes
2answers
28 views

wp_enqueue_script only works outside of action

So i've been trying to figure this out for awhile now. The following code does not seem to work for me. The javascript file will not be included in the footer ( or anywhere for that matter ) function ...
0
votes
3answers
3k views

How do I change/modify the_post_thumbnail(); html output?

I'm working on building out a custom theme and have been struggling with this one for a bit. I am trying to modify the HTML output of the_post_thumbnail(); function. I need to do this because I am ...
1
vote
1answer
467 views

Using add_filter() in Widgets

Just have a query reference the add_filter() function. Can you use this function inside a WordPress widget class. Example I have a widget with dynamic created code that I want to pass to another ...
0
votes
0answers
15 views

Proper way of manipulating a category on your homepage?

I'm using the Genesis theme, and attempting to create a function that finds the homepage AND a specific category, and removes post content under both those conditions. Using my limited knowledge I ...
0
votes
0answers
9 views

custom forgotpassword and hook for additional function

I have other app and a wordpress, whenever if there is a lost password request in the wordpress, it will also trigger for lost password request and other function for the app API.. the password ...
0
votes
1answer
30 views

Warning: array_pop() expects parameter 1 to be array, boolean given

Getting the following php error when trying to add a new post: Warning: array_pop() expects parameter 1 to be array, boolean given in ...
0
votes
0answers
20 views

Create a Function to reference a certain file

Ok, so Imagine user N changes the design on settings to flat ui, the file changes to Framework/styles/flat/style.css from Framework/styles/default/style.css. How can I achieve this? This is possibly ...