Forum Replies Created
-
AuthorPosts
-
Oleaw Digital
ParticipantI have also tried this code. The results are same.
<?php /* Plugin Name: IQQR Properties Plugin URI: https://iqqr.info/ Description: This is my custom plugin that adds a dynamic property field to a custom meta box. Version: 1.0 Author: Ava Carter Author URI: https://iqqr.info/ */ add_filter( 'rwmb_meta_boxes', 'iqqr_properties' ); function iqqr_properties( $meta_boxes ) { $prefix = ''; $post_id = null; if ( isset( $_GET['post'] ) ) { $post_id = intval( $_GET['post'] ); } elseif ( isset( $_POST['post_ID'] ) ) { $post_id = intval( $_POST['post_ID'] ); } $value = 'https://api.qrserver.com/v1/create-qr-code/?size=150x150&data='.$post_id; $meta_boxes[] = [ 'title' => __( 'IQQR Properties', 'iqqr-info' ), 'post_types' => ['iqqr'], 'fields' => [ [ 'id' => $prefix . 'iqqr_qr_url', 'type' => 'hidden', 'std' => $value, ], ], ]; return $meta_boxes; }Oleaw Digital
ParticipantHello,
I'm currently working on generating dynamic field values for use in a Query Loop. I've developed a plugin to add properties to the IQQR post type using a hidden field. I'm utilizing Greenshift's Query Loop Builder, which allows access to Custom Fields. While I can see the iqqr_qr_url custom field, it's returning $post_id as NULL, and I'm only receiving "https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=". Any suggestions how I can achieve this. Please see the attached code.
<div>
<?php
/*
Plugin Name: IQQR Properties
Plugin URI: https://iqqr.info/
Description: This is my custom plugin that adds a dynamic property field to a custom meta box.
Version: 1.0
Author: Ava Carter
Author URI: https://iqqr.info/
*/add_filter( 'rwmb_meta_boxes', 'iqqr_properties' );
function iqqr_properties( $meta_boxes ) {
$prefix = '';
$post_id = get_the_ID();$value = 'https://api.qrserver.com/v1/create-qr-code/?size=150x150&data='.$post_id;
$meta_boxes[] = [
'title' => __( 'IQQR Properties', 'iqqr-info' ),
'post_types' => ['iqqr'],
'fields' => [
[
'id' => $prefix . 'iqqr_qr_url',
'type' => 'hidden',
'std' => $value,
],
],
];return $meta_boxes;
}</div>
Thanks
-
AuthorPosts