All Questions

Filter by
Sorted by
Tagged with
0
votes
0answers
11 views

Plugin hook (location) customizer setting not refreshing in preview (but is on front-end and is upon hard refresh of backend)

I have a plugin that uses custom hooks to set the output location: function my_custom_posts() { if ( locate_template( 'template-parts/my-plugin-parts/featured-posts/custom-posts.php', false ) ) {...
0
votes
1answer
28 views

WordPress wp_get_current_user returning blank values until refresh

I'm developing a site in WordPress and creating my own theme. As part of the theme, I have a custom user login. When a user logs in, the form action directs back to itself and in the header of the ...
1
vote
1answer
31 views

Theme Development: Starter Content after hook

I'm making a Wordpress theme that generate placeholder menus using the theme support "starter content". I read the documentation and is very vague: https://make.wordpress.org/core/2016/11/30/starter-...
0
votes
0answers
30 views

Put CSS Content inside tag <style amp-custom> for Wordpress

I just want to put the CSS's content inside tag <style amp-custom> This is my action inside function function amp_template_add_styles() { $stylesheets = get_template_directory_uri() . '/...
1
vote
1answer
23 views

Highlight “Show all” item in wp_list_categories

I use wp_list_categories to display category filters on post archives. I can use current_category param to set current category - and such item will get addition class current-cat. I can even omit ...
0
votes
2answers
243 views

Control the srcset much more (not all sizes in it each time)

I'd like to be have more control on the srcset on certain important images of my website if not all. By default the srcset includes all the sizes created by wordpress for all the images. I'd like to ...
1
vote
1answer
42 views

Error in custom php function doesn't exist

I was able to successfully set the default page template for a new page, when there is not yet a defined template to be member_home_page.php. This works perfectly on my local environment but when I ...
0
votes
1answer
119 views

How to load a template-part based on a url wildcard?

I'm trying to create a agenda in a custom Wordpress theme. On the agenda page there is a simple page-agenda.php template that will include some code that handles the index of the agenda. Quite simple. ...
0
votes
2answers
48 views

Modify available templates (in dropdown)

I'm developing a WordPress theme with several templates. One template is called "Tabs". If a page with this template assigned has children pages, parts of their contents are shown in tabs on the ...
0
votes
1answer
469 views

How to remove woocommerce_breadcrumb() from do_action( 'woocommerce_before_main_content' ); [closed]

I want to remove woocommerce_breadcrumb from do_action( 'woocommerce_before_main_content' ) in WordPress. How can I do that?
0
votes
1answer
124 views

Difference between “comment_form_default_fields” AND “comment_form_fields”

What is the difference between comment_form_default_fields and comment_form_fields? Description in the official code reference seems to differ only by the word "default". What's the difference in ...
1
vote
1answer
96 views

Is there widely accepted phpDoc syntax for documenting which hook calls a function?

I keep all hooks in one file, and the functions are organized in their respective classes (different auto-loaded files). Looking for a standard way to document that a function's sole purpose is to be ...
1
vote
0answers
15 views

Best place for short bio,image and button [closed]

I'm currently developing a theme that will have a 'hero' section on the homepage. I'm fairly new to theme development and I know in theory I could just enter this as html. However I'd like to give ...
2
votes
2answers
1k views

Change parent theme file function in child themes functions.php

im trying to understand how Action Hooks and Filters work and have this example i want to edit This function is in a parent theme framework php file: public function formatArticleCat01( $...
0
votes
3answers
3k views

call a function when insert and update a custom post type

Here I have custom post type called products and it's taxonomy is product_categories . What I need is whenever I add the post in products , I need to call function1, when I update the post then I ...
1
vote
1answer
435 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?
0
votes
1answer
23 views

Is There A WordPress Hook for Accessing Attachments for A Particular Page?

I'm writing a site with a category that's used for formatting specific types of reports. The user logs in, and writes the report as a blog entry. When they select the category, the report is ...
0
votes
1answer
495 views

Add child pages to submenu automatically

If a new page is added under a parent page (front end), which is part of a nav menu, I want the new page to be added to the appropriate submenu automatically - without any plugin. Reason: A custom ...
0
votes
1answer
130 views

How to hook into wordpress upgrade procedure for a custom theme

I'm trying to create a custom theme upgrade procedure that will selectively overwrite files & backup the old ones in my custom theme, rather than delete & overwrite like wordpress normally ...
0
votes
3answers
437 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
48 views

Creating multiple hooks for theme

Iam working on a theme in the moment and got to the point where I also want to add some custom hooks to some locations, to enable some more flexibility. I want to add multiple hooks to the theme. I ...
0
votes
1answer
21 views

Alter theme pages on language switch

I stumbled upon an issue that I'm not sure how to go forward with. My theme creates two pages on activation. The fact that there are two doesn't matter, it could be 10 pages but just for the ...
-1
votes
2answers
2k views

How to display the category featured images [closed]

I have a custom theme that for the latest posts displays the posts thumbnail. What I am looking to do is to check and if there is no thumbnail set then use the category's featured image. I could ...
3
votes
2answers
506 views

Identifying the priority of style.css so I can make a small CSS file load last

I have a small bit of hourly-changing css and I want to keep it in a second file (apart from style.css) and load it after my theme's style.css file. I believe I can make it load before style.css by ...
4
votes
2answers
652 views

Display a different theme for not logged-in users

Based on answers like this one, I made a small plugin to display a theme displaying a "Coming soon" theme, whilst our team of editors can fill in the final theme. It worked yesterday, but today, even ...
-1
votes
1answer
85 views

Why functions metaboxes is causing White Screen in Admin [closed]

I am having an issue after migrating a project to other server. When I go to /wp-admin I am getting a 'White Screen of Death'. If I access to /wp-login.php instead I get the login form but with an ...
2
votes
1answer
145 views

What function to hook for changes made in status and visibility of a post

I have a function to run every time a post is published or updated in anyway. Right now I am doing function myFunction(){ //Do Something } add_filter('publish_post','myFunction'); add_filter('...
11
votes
4answers
5k views

Issues with title-tag and document_title_parts

Wordpress version 4.5.1 I'm trying to dynamically update page titles on a particular template. After lots of digging and learning about the wp_title() changes, I'm attempting to use ...
1
vote
3answers
3k views

Menu item added in wp_nav_menu_items filter is never highlighted

In a Twenty Thirteen child theme I append a menu item (a link to /player-number page template, where the number is different for each user and represents her or his id in a game database) using the ...
0
votes
1answer
175 views

pre_get_comments or the_content filter

What is the best practice to show social icons always on all the posts and pages. Already I am firing pre_get_comments in my functions.php to show a sidebar between the post content and the comments....
1
vote
3answers
274 views

wp_enqueue_scripts not called on search page?

I've written a custom theme. It's pretty complex so I won't post a huge code block here for everyone's sanity. In my functions.php file I have the following hook being called: function ...
3
votes
3answers
2k views

How to set a custom post type post as static front page?

I am writing my custom theme from scratch and I have a custom post type 'my_frontpage' and want to declare one of it's posts as front-page. I want to do this via admin, hence simply add my cpt to the ...
1
vote
1answer
80 views

How to add theme support?

I figured this would have been a question already, but I haven't come across it. I'm wondering what the correct hook for checking theme support is in a theme and also a plugin. function ...
0
votes
1answer
103 views

Passing variable in hooks and filter

I was trying to pass variables in filtes. This works perfectly for me. class my_class { function my_class() { add_filter('wp_list_categories', array(&$this,'cat_count_span')); } function ...
1
vote
1answer
94 views

Wordpress custom taxonomy check box to dropdown

Hi my custom taxonomy name is country.In this A is a country, a-sub1,a-sub2 are states under A. b-sub1,b-sub2 are state under Country B. Now i need to display the country list(parent) box and state ...
-1
votes
1answer
816 views

how to insert content into wp_head after loop_end

I'm trying to access the info on a post, so I can get the post title and post content so that I can generate the respective OG tags to put in the header. Problem is that the info is only avaiable ...
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 ...
0
votes
1answer
382 views

what is do_action(); in wordpress? [duplicate]

Sorry for making duplicate Topic but it is very important to me because i don't understand this topic by looking other related topics. Actually i am in process to build a WordPress theme and i am ...
5
votes
2answers
13k views

Add custom classes to anchor in wp_nav_menu

I want to add a custom class to anchors in wp_nav_menu outputs. Default for example is: <li id="menu-item" class="menu-item menu-item-type-custom"> <a href="http://example.com">...
0
votes
3answers
508 views

Is it safe to register a taxonomy without using any hooks?

I'm creating a Wordpress site in which I wanted to use a custom taxonomy in my theme options, which I had registered using the 'init' hook. But the problem was that the 'init' hooks gets fired after ...
1
vote
1answer
725 views

Injecting a custom sql query into a page/theme

I have written a custom sql query for our WordPress website (fairly elaborate and not achievable with the standard wordpress code) and I've got it to run via $pageposts = $wpdb->get_results($query, ...
0
votes
1answer
38 views

How to replace settings in WordPress plugin from a theme

I created an array with some default settings in a plugin, and want to allow it to be replaced from functions.php in a theme without using stored data (eg. add_option). I want this to be just a hook ...
0
votes
2answers
210 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 ...
1
vote
1answer
322 views

Single-level menu option? Another way?

I'm developing a child theme of Twenty-Thirteen for a client. My theme contains a second navigation menu properly registered through my functions.php file. This second navigation menu is fully ...
0
votes
2answers
1k views

Dynamic menu links after header title

I am using Parabola theme of Wordpress, and i would like to display few dynamic menu links for logged in users, just at the right of the header title. As shown in the below image, Menu 1 and Menu 2 ...
1
vote
1answer
793 views

Should I use function_exists() and/or add_action() in theme development?

I'm trying to get my theme ready for publication on WordPress.org I got this feedback: function_exist() it is not preferable 3.0 design Now I wonder what I'm doing wrong. In the current ...
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....
0
votes
1answer
192 views

Why enqueue styles on hook?

Why do we need to enqueue styles on a hook, why not just enqueue them straight in like this? wp_enqueue_style( $handle, $src); the codex page gives an example of using a hook but doesn't explain why ...
0
votes
2answers
474 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 ...
1
vote
4answers
4k 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 ...