0
votes
0answers
46 views

admin-ajax.php not working after wordpress 4 update

n WordPress 3.9.2 access to admin-ajax was working for non loggedin users. When I upgraded the script stop working. I have the following code in functions.php function theme_name_scripts() { ...
0
votes
1answer
21 views

Is it possible to be more page/post specific with admin_enqueue_script?

I am using this code to load a stylesheet in the admin, but only on post.php related pages: function my_enqueue_for_post_pages_only($hook) { if( 'post.php' != $hook ) return; ...
0
votes
0answers
19 views

Automatically create featured image on post publish

I know how to make an image display IN PLACE OF a featured image if the post has no featured image, however, as far as the database is concerned, the post still has no featured image. In my theme, ...
0
votes
1answer
75 views

get_post_meta not working inside a function in functions.php but works outside

function notify_new_posts($post_id) { $keyval = get_post_meta( $post_id); $buyer_wdistance = get_post_meta( $post_id, 'cf_wdrive'); //$buyer_wdistance = $keyval['cf_wdrive'][0]; ...
0
votes
1answer
74 views

Replace admin header logo with an image

I want to replace the default WordPress admin bar logo to my custom logo which is a PNG file. I have tried a code it's not working. function custom_logo_admin_header() { echo ' <style ...
0
votes
2answers
78 views

How to hook into the quick edit action?

I found this solution to automatically assign parent terms when a child term is selected, which is working fine for the save_post hook: add_action('save_post', 'assign_parent_terms'); function ...
0
votes
1answer
50 views

Dynamically Generate Functions and Hooks

I'm trying to find if it's possible to dynamically generate functions and hooks. All functions do the same thing, and all hooks are essentially the same. Here's an example of a hook/function combo: ...
0
votes
0answers
67 views

Init hook for header send

I am working on a checkout proces where if I submit the checkout I get an error "headers already send" because I use a PHP header() function to send the customer to my payment provider url. My idea ...
1
vote
2answers
110 views

Define custom Page Template without its own .php file

Is there any way of defining a Page Template from some function/filter/hook, without having any .php file containing the comment at the top of the page to declare the Template Name? For example, ...
0
votes
2answers
123 views

jQuery does not work

I am working on a project where I need jQuery for. I added this to my functions, and the scripts are loaded in my header if I watch my page source, but jQuery doesn't work. What am I doing wrong? ...
0
votes
1answer
117 views

How can I add a Custom Button to Add or Edit post / page next to Add Media?

I'm trying to add a custom button nearby the Add media on the wordpress Add and Edit Post/Page. How can I do that? Thank you very much for your help!
0
votes
2answers
70 views

Override the Wordpress core function wp_referer_field

I'd like to override the core Wordpress function wp_referer_field to change the value of $referer_field variable inside of it. I've found that wp_referer_field is not pluggable and that I need to ...
0
votes
1answer
55 views

Is there a way to prevent a function/method from being called outside a specific hook?

I would like to make function only callable by a specific action, in this case the register_activation_hook() function. How can I do this?
0
votes
0answers
60 views

WordPress Visual Editor Filter for Visual View

I have setup custom HTML to be created when a user inserts media using "Add Media" in WordPress using the code below: add_filter('get_image_tag', 'add_image_frames', 10, 6); function ...
0
votes
1answer
70 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
2answers
114 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
35 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 ...
1
vote
1answer
676 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 ...
-1
votes
1answer
193 views

How to hook wp_mail to add a custom email as BCC for each sent email?

Is there a way to hook into the wp_mail function to add a custom email as hidden (BCC) copy to each email sent? If so, how? -edit- It's not like I want to send an email with BCC, I would like to ...
1
vote
1answer
94 views

Get current page_id before loop, in functions.php

In the Shoestrap theme, you often change content by using hooks. I want to add the following to functions.php but it doesn't work... // in functions.php if ( is_home() ) { add_action( ...
0
votes
1answer
475 views

Add an Outside Wrapper to my Header and Make it Full Width

I did reposition the <header> outside the 'wrap class' class by adding this function in my function.php /** Reposition header outside main wrap */ remove_action( 'genesis_header', ...
3
votes
1answer
3k views

How to create thumbnails for PDF uploads?

I'm developing a website that needs to allow users, within Gravity Forms, to submit a PDF file and have a JPG thumbnail created of the first page of the PDF that is then displayed in the created post. ...
0
votes
1answer
183 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 ...
0
votes
0answers
84 views

functions.php conditional output for a single plugin

hope I've asked this correctly. Bizarre situation. I have some non-breaking spaces in my titles for typography reasons. They are added automatically where required in place of normal spaces by the ...
1
vote
1answer
184 views

Change the footer text on the login page

I am customising the login page and would like to alter the footer text that takes the user back to the website. Ideally and as an example, changing it from the first image, to the second just below: ...
-1
votes
2answers
378 views

How to pass hook variable to function?

I have a function that has an add_action inside it that calls the user_register hook. I would like to be able to echo the variable $user_id from the user_register hook and the $_POST array as well. ...
0
votes
1answer
834 views

is_home() not working in functions.php file

I'm using woo themes and trying to use some woo hooks to hook into the index.php file from my child theme. I'm using the following code: function content_woo_main_before() { if (is_home() || ...
1
vote
2answers
320 views

Passing values from a widget to a function within a plugin

I have a plugin that is built with many widgets. A widget's bundle. Each widget creates it's own custom CSS code. Instead of having messy source code where I display 15 different sets of inline CSS ...
0
votes
1answer
87 views

How to conditionally add a widget via a hook in functions.php

I'm trying to add some widget areas to the homepage only using functions.php - so that the client won't be able to accidentally destroy shortcode when editing the page. I've registered the widget ...
0
votes
0answers
283 views

Get User Login Data (date, time… )

I did my best looking for information about this subject. Your guidance is appreciated. My goal is to perform some actions based on the number of user logins on my website per month and login days ...
0
votes
1answer
89 views

How to return hook data when multiple parameters are present?

What is the proper way of returning data to a hook when there is more than one parameter present? Example apply_filters('image_downsize', false, $attachment->ID, $size) Attaching a callback ...
1
vote
1answer
362 views

How to remove a metabox from menu editor page?

I am not sure if it is much different for any page but I am wondering how to remove a metabox from the appearance>menu page without having to go into the wordpress core files and remove it. Is there ...
6
votes
4answers
3k views

Import Wordpress XML File from Within Functions.php

I am developing a theme which has a different method of adding in content and so, the default install of Wordpress won't show any content because of this. I was wondering if it is possible to ...
0
votes
2answers
316 views

Theme not calling Jquery properly

I am developing a theme and I have called jquery along with other JS files from a theme-enqueue.php file. For some reason only the Jquery file that is hosted on googles servers is adding the theme URL ...
0
votes
3answers
666 views

Theme Customizer not loading JS for live preview

I am currently working on adding options to the theme customizer. For the last two hours I have been trying to get the live preview working and I am trying figure out why my theme isn't loading the ...
1
vote
2answers
512 views

gform_after_submission content appears immediately after <body>, not in post body [closed]

I have the following function that successfully uses form fields (IDs 13 and 18) from a Gravity Form (ID 18) as parameters within wp_query. This displays a list of posts with specific taxonomy terms ...
2
votes
1answer
477 views

Gravity Forms field entries into wp_query loop [closed]

I have a simple function that filters the page content when form (ID 18) is submitted. It simply displays the entry of field (ID 13)... add_action("gform_after_submission_18", "set_post_content", 10, ...
2
votes
2answers
1k views

Issue with get_theme_mod returning a blank value instead of the saved value

I have what seems to be a rather troubling issue with the get_theme_mod function in the latest version of Wordpress. Only on particular servers (of which meet all Wordpress requirements) the function ...
0
votes
1answer
38 views

Hook into a function without a hook?

I have just got into using hooks and have now understand the beauty of them. I understand that I can hook into the following by using add_filter('hook_name','my_hook_name', $variable); function ...
2
votes
2answers
144 views

Placement of Code in Plugin for hooking `save_post`

I ran into a strange Problem today developing a new Plugin. I set it up as usual, creating the f711-roomprice folder in the Plugindirectory, and creating the f711-roomprice.php as well as an inc ...
0
votes
1answer
147 views

Auto log in hook is requiring a page refresh

I have a simple auto log in hook that looks like the following: function auto_login() { if (!is_user_logged_in()) { //Removed some code for brevity. $user = ...
2
votes
1answer
447 views

Post thumbnail relative link and HTML modify

I want to remove the website url from all the_post_thumbnail() so they become relative and remove/add attributes from the output. So far I got the following code added to functions.php of the theme, ...
0
votes
1answer
270 views

How to place a div inside a function that creates a div

I am wondering how instead of having the menuTab div come after the bones_main_nav function html code that is outputted to have it injected inside of it I suppose. I have the following function // ...
1
vote
1answer
269 views

Adding option to Gallery shortcode

just starting out in WP dev, and I'm looking for any guidance I can get. What I'd like to do is use a hook or filter to add my own option to the core WP gallery shortcode. I would want it to work just ...
1
vote
1answer
775 views

Add action hook conditionally - only when home.php in use

I am trying to add action hook in functions.php only if the page is home.php but the following does not work if ( is_page_template("home.php") ) { // do stuff } To make sure that file being used ...
0
votes
1answer
485 views

Add custom fields after post/page title

I am using the Headway theme, and I need to add custom field code to page & posttitles. This is what I need to be able to do. The red button will be added through a custom field. It needs to be ...
0
votes
1answer
171 views

Force resize for all video content

I'm looking for a way to force all video content on my site to scale to 100% width and I'm hoping to avoid using any additional javascript. Is there a filter or function that I can use to accomplish ...
-1
votes
1answer
108 views

How to automatically create a custom field when a post is published?

I'm trying to add custom fields on post publish with this code which I added to my functions.php : add_action('publish_page', 'add_custom_field_automatically'); add_action('publish_post'. ...
1
vote
1answer
595 views

correct way to call javascript into hook function

function node_wp($post_ID) { global $post; $post_title = get_the_title( $post_ID ); $post_url = get_permalink( $post_ID ); $json = array( 'title_post' => $post_title, ...
1
vote
1answer
305 views

Which action does wp_update_user triggers?

I am working modifying an ecommerce plugin, and it makes uses of wp_update_user() function, and everytime the function runs another table (created by the plugin), gets updated too. The problem is that ...