Skip to content

Instantly share code, notes, and snippets.

@SteveBarnett
SteveBarnett / notes.md
Last active October 6, 2023 01:45
OBS dual wield / dual video and audio

Send a second video using Full-screen Projector

  • Right click on the Preview, "Full-screen Projector (Preview)" menu item.
  • Choose the second screen from the list.

Send a second audio using Monitor

  • Go Settings > Audio. In Advanced, set the Monitoring Device to the second screen.
  • Go to Advanced Audio Properties (in the Audio mixer panel click the Cog, or the three dots button next to an audio source).
  • Choose "Monitor and Output" in the Audio Monitoring column for the correct audio source.
@Crocoblock
Crocoblock / register-options-page.php
Last active June 29, 2023 09:04
JetEngine Register Options page programmatically
<?php
add_action( 'init', 'register_my_custom_options_page', 20 );
function register_my_custom_options_page() {
$args = array (
'slug' => 'option-slug',
'labels' =>
array (
@Crocoblock
Crocoblock / jet-engine-filter-repeater.php
Created January 23, 2023 15:38
JetEngine Filter repeater items before output
<?php
add_filter( 'jet-engine/listings/dynamic-repeater/pre-get-saved', function( $items, $settings ) {
$classes = $settings['_css_classes'] ?? '';
if ( ! $classes ) {
return false;
}
@Crocoblock
Crocoblock / add-meta-box.php
Last active June 29, 2023 09:07
JetEngine Register meta box for CPT/taxonomy/user programmatically
<?php
add_action( 'jet-engine/meta-boxes/register-instances', function( $meta ) {
//all field types are given for the reference, you can add any amount of fields of any type
$meta_fields = array (
array (
'title' => 'reference-text',
'name' => 'reference-text',
@Crocoblock
Crocoblock / dynamic-field-custom-source.php
Created October 7, 2022 12:10
Add new Source to JetEngine Dynamic Field
<?php
class Dynamic_Filed_Source_Maybe_Unserialize {
public function __construct() {
add_filter( 'jet-engine/listings/dynamic-field/field-value', array( $this, 'process_value' ), 0, 2 );
add_filter( 'jet-engine/listings/data/sources', array( $this, 'add_source' ) );
}
public function process_value( $value, $settings ) {
@Crocoblock
Crocoblock / register-relation.php
Last active December 8, 2023 08:22
JetEngine Relations: update items programmatically, register a relation programmatically
<?php
add_filter( 'jet-engine/relations/raw-relations', function( $relations ) {
$relations[999] = array(
'name' => 'User to post',
'parent_rel' => null,
'type' => 'many_to_many',
'is_legacy' => false,
'id' => 999,
@Crocoblock
Crocoblock / get-related.md
Last active May 3, 2024 18:20
Get JetEngine Related Items programmatically / Update related items / Get/Update relation meta
@MjHead
MjHead / get-realtion-meta.php
Created August 17, 2022 07:59
Get meta data from JetEngine relations from the code
<?php
$rel_id = 111; // Set here your actual Relation ID. You can get it from an address bar on relation settings edit page
$relation = jet_engine()->relations->get_active_relations( $rel_id );
$parent_id = 111; // ID of prequired arent object from relation
$child_id = 111; // ID of prequired arent object from relation
$key = 'meta_key'; // Name/ID of meta field to get
$meta_value = $relation->get_meta( $parent_id, $child_id, $key );
@Crocoblock
Crocoblock / get-meta.php
Last active February 19, 2024 09:11
Get current JetEngine listing object meta value ( somewhat similar to ACF get_field() )
<?php
//You may just use get_post_meta() to get post/term/user meta
//However, in Listing Grid, you may use get_meta() method for convenience
$value = jet_engine()->listings->data->get_meta( $meta_key, $object );
/**
* Get object meta value. Works for Posts, Terms, Users, Comments
* $object defaults to null, then the value will be retrieved from the current listing object
@MjHead
MjHead / get-jet-engine-meta-fields.php
Last active April 6, 2024 17:55
JetEngine. Get registered meta fields by given context - post type, taxonomy or user
<?php
/**
* Get fields for the given context and object
* Should be called on hook 'init' with priority 11 or later
*/
// Fields for Post post type
$post_fields = jet_engine()->meta_boxes->get_fields_for_context( 'post_type', 'post' );
// Fields for Product post type