The Stack Overflow podcast is back! Listen to an interview with our new CEO.

All Questions

Filter by
Sorted by
Tagged with
1
vote
2answers
355 views

Custom post type archive sorted and grouped by date in post meta field

I am trying to build an Custom Post Type for showing information about events. The Custom Post Type has name 'Event', with the following meta fields: event_startdate (date in format YYYY-MM-DD) ...
0
votes
0answers
23 views

What is the recommended way to save errors / warnings / user messages from actions / filters for custom display in the frontend?

This is a very basic question and there are a lot of solutions to it - however what is the recommended (or at least a good) way? Problem statement: While processing a request to a WordPress project ...
1
vote
1answer
70 views

Use debugging for add action events

Is it possible to vardump the variable inside the action function? i am not able to echo or see results when i am doing so. This is not a woo commerce question but i am having problems with ...
0
votes
0answers
45 views

Remove action added in plugin class from theme

I am trying to remove action that is added via plugin in my theme. The below plugin class creates a portfolio page template but I don't want this page template in my theme. Is there any way to unhook ...
1
vote
2answers
353 views

How to make content editable from admin page?

I have a landing page that has to be somehow converted into wordpress theme. And what I want to do is to make an admin page with editable fields that will correspond to the content on the front end. ...
1
vote
1answer
451 views

What's the difference between hooks, filters and actions? [duplicate]

It seems like the terms hooks, filters and actions are used interchangeably. What's the difference between them? What do they do? How do I use them?
3
votes
2answers
513 views

How to access certain WP functions inside custom class, in theme folder

I'm building a custom theme and I want to create a helper class for handling creation of metaboxes in admin panel. I have my class declared like this: namespace ci\wp; Metaboxes::init(); class ...
1
vote
1answer
17 views

Tried in different ways but sidebar not working?

function Y_widget_register(){ register_sidebar(array( 'name'=>esc_html__( 'Sidebar', 'Y-07' ), 'id'=> 'y-sidebar', 'description'=>'Dynamic Right Sidebar', 'before_widget' =...
0
votes
3answers
448 views

What does Wordpress do if I save a post without content/title? [duplicate]

I've created (as part of a theme) a few metaboxes for my post type. The metaboxes allow the user to interact with different instances of tinyMCE. Everything is working as it should, however, I can't ...
1
vote
1answer
42 views

Wordpress taxonomy and archive custom class

I want to add custom class. But archive and custom taxonomy both are executed at the same time. When I want to add class to taxonomy page, the archive class is also added. I understand taxonomy is ...
3
votes
4answers
484 views

What is a good way to pass a variable from add_action to a Theme?

Inside functions.php: add_action('init','my_action'); function my_action() { if($dontknow) { $passme = "yes"; } else { $passme = "no"; } } Inside index.php of the ...
0
votes
2answers
444 views

after_setup_theme, Global Variable and Theme Customizer

I am using a global variable that is defining in a function runs in after_setup_theme. This variable is not getting update changes in Theme Customizer. Let me explain this with an example: ...
5
votes
1answer
211 views

Getting instance variable in scope of 'wp_enqueue_scripts'

I need a little help getting my head around passing instance variable to a hook. I am reading the CSS files I need in my template dynamically and storing them in a $settings object that I am keeping ...
3
votes
1answer
174 views

Theme elements not translating

Ive got a theme that is set-up for translating but didn't come with any translations. I used poedit to automatically detect the strings, and subsequently translated it in full. However certain ...
0
votes
1answer
23 views

Never actually adding the action? Or do I have to call the action?

I have the following class that is instantiated in the function.php file. In the constructor I am setting up a activation and a deactivation hook for the theme. How ever neither seem to be called when ...
2
votes
1answer
796 views

Add custom buttons with custom actions in Edit Post screen in WordPress?

I am creating something for a client and I have a Class that I created with a Custom Post Type called 'PuSH Feeds' and when the user adds a new post and publishes it they can then click on one of two ...
0
votes
1answer
45 views

Overide enqueue in non plugable function via child theme

I am trying to override a non-plugable function using the information on this page but it seems to have no effect. Can anyone see what's wrong. My code is remove_action('wp_print_styles', '...
0
votes
0answers
119 views

Suppress the_content filter in a nested loop

I have some layout changes that are being applied to the_content. I need to do one of two things, but neither is working as expected... either: Pass data to the filter so that it knows if it is a "...
0
votes
1answer
2k 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 style....
2
votes
0answers
465 views

How to write .htaccess dynamically? [closed]

I am trying to set permalink structure on theme activation. The following function included in function.php of theme. // Executes function on theme activation function myactivationfunction() { ...
0
votes
0answers
244 views

add_action not working in header?

i need to enable the session variables to my theme , so i have the following code in my theme functions.php function session_manager() { if (!session_id()) { session_start(); // Get ...
1
vote
1answer
1k views

Is there an action for save_menu and/or update_menu?

I want to "save" my menus into transients. I want to update those when there's been any changes to the menus via the admin custom menus. I've looked for an action but can't see to find anything. ...
0
votes
1answer
283 views

Replace function in a child theme

Is there a way to replace a function by another function in a child theme? In other words, in a theme there is a function named "theme_function" and this function is called by several files inside the ...
4
votes
5answers
769 views

How do I Make a Theme “plugin-ready”?

How do I revise a theme so that I can publish my event hooks and anyone can build a plugin to add new functionality easily to my theme?
2
votes
2answers
3k views

How to use filter hook 'post_updated_messages' in coherence with action hook 'save_post'

I am trying to send out e-mail, SMS and IM notifications to group members of this WordPress website, whenever a WordPress page in their user group has been published/updated. I figured using the ...
10
votes
2answers
29k views

When to use add_action('init') vs add_action('wp_enqueue_scripts')

In my theme's functions.php, I'm calling an add_action in order to gain a measure of control on where jquery is loaded (in the footer along with my theme's other scripts). The problem I'm having is ...
11
votes
5answers
5k views

after_setup_theme always runs

I am setting up a child theme for some of my faculty members, and as a part of the theme, I would like a handful of plugins to be activated at the time that the theme is activated. So, naturally, I ...
2
votes
2answers
164 views

What's the best action to use when you want to do something only once per theme setup?

I'm writing a theme which has it's own set of database tables. I'm wondering what is the best action for me to use when I want my install function to be invoked only once when the theme is activated ...
0
votes
1answer
444 views

save_post action doesn't passing post id to my function as argument

I'm adding a box to add / update post screen. add_action( 'save_post', 'psd_upload_kaydet' ); add_action( 'add_meta_boxes', 'psd_upload' ); function psd_upload() { add_meta_box("psd-upload", "Bir ...
0
votes
1answer
116 views

How to make a function occurs for one time?

I have the following code in the functions.php file in my theme function my_func(){ echo "foo"; } add_action('admin_menu','my_func'); I assume this function "my_func" will be ...
1
vote
1answer
268 views

Does the switch_theme action run when you're upgrading a theme?

Did anyone test if this action is being executed on theme upgrade? Are there any other actions I could use to attach a theme uninstall function?
14
votes
3answers
3k views

get_template_part vs action hooks in themes

It seems to me both of these afford the opportunity for the end user to modify a theme without actually editing the themes files (via child themes). My question is, is one method preferred over the ...