Wordpress Hooks

  • muplugins_loaded
    • no after hook. 
    • This hook is triggered after Must-Use plugins are loaded and does not have a corresponding "after" hook.
  • plugins_loaded
    • no after hook. 
    • It indicates that all active plugins have been loaded. There is no specific "after" version.
  • setup_theme
    • after_setup_theme. 
    • The after_setup_theme hook is specifically designed to run after the theme has been initialized.
  • after_setup_theme
    • this is the after hook for setup_theme
  • unload_textdomain
    • no after hook
    • This hook is specifically used to unload a text domain, removing all translations associated with it from memory. It's particularly useful in scenarios where you need to switch translations or unload them entirely to free up resources or manage memory in a dynamic multilingual environment.
  • load_textdomain
    • no after hook
    • load_textdomain is a crucial function for setting up internationalization by loading a .mo file (which contains compiled translation data) into the text domain specified.
  • init
    • no after hook
    • This hook is used to trigger functions after WordPress has finished loading but before any headers are sent. There is no "after_init" hook, but wp_loaded often serves a similar purpose, indicating the system is fully loaded.
  • widgets_init
    • no after hook
    • The widgets_init action hook in WordPress is used to initialize widgets and register widget areas (also known as sidebars).
  • register_sidebar
    • this one is not a hook. it is a function that is called by other hooks/events
  • wp_loaded
    • no after hook
    • This hook is used to indicate that WordPress and all its plugins and themes have been fully loaded and instantiated.
  • parse_request
    • no after hook
    • This hook allows developers to manipulate the WP query object immediately after the query variables have been parsed.
  • send_headers
    • no after hook
    • The send_headers action hook in WordPress is used to modify HTTP headers before they are sent to the browser. This hook provides a mechanism to intercept and alter HTTP headers or perform actions based on header information. Its use implies that it is effectively the point at which you can last modify headers before they are sent out as part of the HTTP response.
  • pre_get_posts
    • No after hook
    • It is used to adjust the query parameters before the query is actually executed.
  • posts_selection
    • no after hook
    • The posts_selection hook in WordPress is a somewhat lesser-known action that is triggered just before the main WordPress query object (WP_Query) retrieves posts from the database. It allows you to perform actions or modify the environment immediately before posts are selected by the query. 
  • posts_request
    • no after hook. (this one is a filter, not a hook)
    • The posts_request hook in WordPress is a filter, not an action, which is used to modify the SQL query string that is generated by WP_Query just before it is sent to the database. This filter provides a way to adjust or completely replace the SQL query used to retrieve posts.
  • the_post
    • No after hook
    • This hook is used primarily within the loop to modify the global $post object as needed.
  • wp
    • No after hook
    • This hook runs once WordPress has set up all query variables and the current user, but before the actual query execution.
  • template_redirect
    • No after hook
    • This is used to redirect users before a template is loaded. It is a point to hook in and change the template that will be included but does not have an "after" counterpart.
  • get_header
    • no after hook
    • The get_header action hook in WordPress is used specifically to perform actions just before the header template file (header.php) is loaded. It is primarily utilized for enqueuing scripts, adding inline styles, or performing any setup required specifically for the header. 
  • wp_head (loading of scripts and styles)
    • no after hook
    • The wp_head action hook in WordPress is a crucial part of the theme and plugin ecosystem, providing a place to inject elements into the <head> section of HTML documents. This hook is used extensively to add metadata, link tags, inline styles, scripts, and other elements essential for a website's functionality and performance.
  • get_sidebar
    • no after hook
    • The get_sidebar action hook in WordPress is used to include sidebar template files, typically named sidebar.php, within a theme. This hook allows developers to execute code before and after the sidebar is loaded
  • get_footer
    • No after hook
    • The get_footer action hook in WordPress is used similarly to get_header, specifically for including the footer template file, typically named footer.php, within a theme. This hook allows developers to execute code just before the footer is loaded.
  • wp_footer
    • No after hook
    • The wp_footer action hook in WordPress is an essential part of theme development, used to insert necessary scripts, tracking codes, and other types of content into the footer of a WordPress site just before the closing </body> tag. It represents one of the last hooks you can use to output HTML or scripts before the HTML document ends.
  • wp_print_footer_scripts
    • No after hook
    • The wp_print_footer_scripts action hook in WordPress is used specifically for printing scripts enqueued for the footer. This hook is an essential part of WordPress's script loading mechanism, ensuring that scripts designated to be output in the footer are done so at the correct time.
  • admin_bar_menu
    • No after hook
    • The admin_bar_menu action hook in WordPress is used to manipulate the WordPress admin bar, also known as the Toolbar. It allows developers to add, remove, or modify items in the admin bar. 
  • wp_before_admin_bar_render
    • No after hook
    • The wp_before_admin_bar_render action hook in WordPress is specifically used to execute actions just before the WordPress admin bar (Toolbar) is rendered. This hook provides a timely opportunity to make last-minute adjustments or additions to the admin bar before it's output to the HTML of a page.
  • wp_after_admin_bar_render
    • Although there is no after hook for wp_before_admin_bar_render, this hook essentially serves that same purpose since it fires immediately after the admin bar is rendered.
  • shutdown
    • The shutdown action hook in WordPress is used to perform actions right before PHP finishes executing a script. It runs after WordPress has completed all its tasks and is about to conclude the page request. This is typically the last action hook that WordPress fires, making it ideal for tasks that need to be performed at the end of the execution cycle.

Escape Room Game - Add Meta Avatars SDK

 Add Meta Avatars SDK

I followed the course on Udemy to setup Meta Avatars with Photon / Fusion

https://www.udemy.com/course/unity-vr-meta-avatars-oculus-fusion/learn/lecture/40024280#questions/20877846

Basic Steps are to:


IMPORTANT:

I was hung up on this for hours, but to get the latest version (24.0) of Meta Avatars SDK working, you have to make sure you import the sample assets like this:


In the screenshot above it says Reimport, but that is because I already imported the samples. It would just say Import if I didn't already do that.




Escape Room Game - Add Photon

 Add Photon

Photon

Photon is a package that can be added for multiplayer games. This tool is free for small projects / independent developers. I had to create an account. The package works with a public server to sync the game across users.

Photon Website


Photon in Unity Tutorial




Escape Room Game - Create a Lobby Scene

 Create a Lobby Scene

Create a Room for the Scene


Select New Shape (or PolyShape, depending on what you are shape you want to use) in the ProBuilder Tools Window

Resize it to the size that you want

If you want to use the shape for your scene, then Flip the Normals

  • Select the Face mode icon (the far right icon at the top of the scene view)
  • Double click any face
  • In the ProBuilder window, click Flip the normals

Moving Around the Scene


Add an OVRPlayerController so I can walk around my scene. See Setup the Project for Oculus to learn how to do this.

Assets


Import the assets you want to use in your scene

If the assets are pink or magenta, 



Check all the checkboxes in the Render Pipeline Converter window



Click Initialize and Convert


Escape Room Game - Install ProGrids

 Install ProGrids

Go to Window -> Package Manager

Click the + icon with the dropdown arrow

Click Add package by name...

Enter com.unity.progrids and click Add


Once it is done being installed you will see this

The ProGrids Toolbar should show up automatically, but if it doesn't go to Tools -> ProGrids -> ProGrids Window and it will appear in your viewer

















Escape Room Game - Install ProBuilder

Install ProBuilder

Follow the steps on this page to install ProBuilder in the project

https://docs.unity3d.com/Packages/com.unity.probuilder@4.0/manual/installing.html

The document doesn't mention it, but be sure to select Packages: Unity Registry before searching for ProBuilder or else it won't find it

Once you have ProBuilder open (as per the instructions on that link), click and drag it by the tab to dock it where you want it.

Escape Room Game - Setup the Project for Occulus

 Setup the Project for Oculus


Follow this to setup my Unity Project for Oculus

Get Started with Meta Quest Development in Unity - this is a series of articles that shows you how to setup your project for the Oculus Quest. Some of the specific articles that I followed include:
After following the steps above my project was able to be built and run on the Oculus. However, I still needed to be able to move around the scene. In order to do that, I did the following:

Unity and Oculus Meta Quest - Lesson 01 Setting up Tutorial - this is a series of videos that shows how to develop for the Oculus in Unity.

Unity and Oculus Meta Quest 2 Tutorial 05 - Moving your player - this is a short video from that same series that shows you how to create an object that represents the player (OVRPlayerController) with the camera attached (OVRCameraRig) and then hook up the left and right hand controls. After this, you are able to walk around your scene and move the camera view just like you can in other Oculus games you are familiar with. I think I still need to hook this up to an object that can be seen in the game, like an avatar, or some other object so that other players can see me in a multiplayer game.



Things I did initially before I found the above series on youtube and the documentation on from Meta


Go to Edit -> Project Settings


Scroll down to the XR Plug-in Management section on the left and select the Android tab on the right (You can see the little Android robot icon)


Uncheck OpenXR and then check Oculus


Click the X in the top right of the window to save your changes and exit


Follow the steps on this page to build your project for Oculus:


After following those steps, it still didn't load for me on the Oculus. I'm not certain that the following steps fixed this for me, but after doing this (in addition to the steps above) and clicking Build and Run, then it loaded on the Oculus for me.

Go to Edit -> Project Settings -> XR Plug-In Management (Same as before)

Go to the Windows, Mac, Linux Settings tab and make sure the Oculus option was checked


Go to the Dedicated Server Settings tab and make sure the Oculus option was checked


Go to File -> Build Settings -> Build and Run (again)



Confirm the game is loaded on the Oculus

If the game did not start immediately, then you can start it yourself

On the Oculus, Go to the Applications screen

Make sure the Unknown Sources option is selected in the dropdown menu at the top right. The All option will not show your game. Only the Unknown Sources option will.

Click your game to start it.
















} else { }