Hazel Z.
Forum Replies Created
-
Hi! Thank you. Good to know that it has been forwarded to dev. Looking forward to the next update. Have a great day!
Forum: Plugins
In reply to: [SimpleTOC - Table of Contents Block] Show just one specific heading (H2)I also need this feature. I want to show only the H4 headings on the TOC.
Ok. Thank you, Jen.
Great! Thank you. The fix has worked. ?? @ethanchoi
Hi @champsupertramp. Ultimate Member is still not detecting my custom meta keys. The posts on the Profile page are outputted as:
string(3) “654” Test
string(3) “631” Test
string(3) “629” TestIt outputs the correct post ID but the title still shows “Test” which means the custom meta keys are not being read.
- This reply was modified 3 years, 8 months ago by Hazel Z..
Hi @ethanchoi! Any updates?
@champsupertramp I did as you asked. It showed that the correct post IDs are not returning correctly. The page id is returning instead. Please see screenshot:
https://drive.google.com/file/d/1Vd55GmVQktu5OcNsFPSGhFMxfRYBcJ9E/view?usp=sharing
@champsupertramp This is code from my posts-single.php file (which is created to override the default plugin file):
<div class="um-item-link"> <i class="um-icon-ios-paper"></i> <a href="<?php echo esc_url( get_permalink( $post ) ); ?>"><?php echo do_shortcode('[date_of_progress_report]'); ?></a> </div>
Note that instead of the $post->post_title, it is set to output the shortcode [date_of_progress_report]. The shortcode function in functions.php is:
//* Post Title Shortcode add_shortcode( 'date_of_progress_report', 'displayPostTitle'); function displayPostTitle() { global $post; $dayoftheweek = get_post_meta( get_the_ID(), 'day_of_the_week', true ); // old setting $monthoftheyear = get_post_meta( get_the_ID(), 'month_of_the_year', true ); //new setting $dayoftheweek2 = get_post_meta( get_the_ID(), 'day_of_the_week_2', true ); // new setting $yearnow = get_post_meta( get_the_ID(), 'year_now', true ); // new setting if ( !empty($monthoftheyear) ) { // new setting // Convert Date String if ($monthoftheyear == "January") { $monthnow = '01'; } if ($monthoftheyear == "February") { $monthnow = '02'; } if ($monthoftheyear == "March") { $monthnow = '03'; } if ($monthoftheyear == "April") { $monthnow = '04'; } if ($monthoftheyear == "May") { $monthnow = '05'; } if ($monthoftheyear == "June") { $monthnow = '06'; } if ($monthoftheyear == "July") { $monthnow = '07'; } if ($monthoftheyear == "August") { $monthnow = '08'; } if ($monthoftheyear == "September") { $monthnow = '09'; } if ($monthoftheyear == "October") { $monthnow = '10'; } if ($monthoftheyear == "November") { $monthnow = '11'; } if ($monthoftheyear == "December") { $monthnow = '12'; } //Our YYYY-MM-DD date string. $date = "2002-12-02"; $date = $yearnow .'-'.$monthnow .'-'. $day_of_the_week_2; //Convert the date string into a unix timestamp. $unixTimestamp = strtotime($date); //Get the day of the week using PHP's date function. $nameOfDay = date("l", $unixTimestamp); $post->post_title = $monthoftheyear .' '. $dayoftheweek2 .', '. $yearnow .' ('. $nameOfDay .')'; return $post->post_title; } elseif ( !empty($dayoftheweek) ) { // old setting return $post->post_title .' ('. $dayoftheweek .')'; } else { return 'Test'; } }
Note that at the bottom of the code, I set it to return ‘Test’… so that if Ultimate Member is reading and outputting the shortcode but without acquiring the custom meta key values ($monthoftheyear, $dayoftheweek, $dayoftheweek2, $yearnow)… the post titles on the UM User Profile Page will be displayed as “Test”.
Upon checking the UM User Profile Page… the post titles are indeed displaying as “Test” (instead of outputting the values of $monthoftheyear, $dayoftheweek, $dayoftheweek2, $yearnow). Here is the screenshot:
https://drive.google.com/file/d/1R3LNfiNQSJ0MRPdm1APGfNRUfkjMVY1S/view?usp=sharing
UM is not able to recognize these variables — $monthoftheyear, $dayoftheweek, $dayoftheweek2, $yearnow.
How do I make UM recognize these variables so it can output these custom meta keys?
Thank you for the response.
I found that UM is actually reading and outputting the shortcode. The problem is that UM is not reading the custom meta key values from the WP Frontend Form.
Here is my code in functions.php
//* Post Title Shortcode add_shortcode( 'date_of_progress_report', 'displayPostTitle'); function displayPostTitle() { global $post; $dayoftheweek = get_post_meta( get_the_ID(), 'day_of_the_week', true ); // old setting $monthoftheyear = get_post_meta( get_the_ID(), 'month_of_the_year', true ); //new setting $dayoftheweek2 = get_post_meta( get_the_ID(), 'day_of_the_week_2', true ); // new setting $yearnow = get_post_meta( get_the_ID(), 'year_now', true ); // new setting if ( !empty($monthoftheyear) ) { // new setting // Convert Date String if ($monthoftheyear == "January") { $monthnow = '01'; } if ($monthoftheyear == "February") { $monthnow = '02'; } if ($monthoftheyear == "March") { $monthnow = '03'; } if ($monthoftheyear == "April") { $monthnow = '04'; } if ($monthoftheyear == "May") { $monthnow = '05'; } if ($monthoftheyear == "June") { $monthnow = '06'; } if ($monthoftheyear == "July") { $monthnow = '07'; } if ($monthoftheyear == "August") { $monthnow = '08'; } if ($monthoftheyear == "September") { $monthnow = '09'; } if ($monthoftheyear == "October") { $monthnow = '10'; } if ($monthoftheyear == "November") { $monthnow = '11'; } if ($monthoftheyear == "December") { $monthnow = '12'; } //Our YYYY-MM-DD date string. $date = "2002-12-02"; $date = $yearnow .'-'.$monthnow .'-'. $day_of_the_week_2; //Convert the date string into a unix timestamp. $unixTimestamp = strtotime($date); //Get the day of the week using PHP's date function. $nameOfDay = date("l", $unixTimestamp); $post->post_title = $monthoftheyear .' '. $dayoftheweek2 .', '. $yearnow .' ('. $nameOfDay .')'; return $post->post_title; } elseif ( !empty($dayoftheweek) ) { // old setting return $post->post_title .' ('. $dayoftheweek .')'; } else { return 'Test'; } }
The output is Test… which means that UM is not reading any of the custom fields at all. @champsupertramp
Thank you for the response.
- This reply was modified 3 years, 9 months ago by Hazel Z..
I am using Ultimate Member and WP User Frontend together. WP User Frontend takes care of the frontend posting and Ultimate Member takes care of content and page restrictions.
On my WP User Frontend form that users use to create and publish a post, the default value of the Post Title field is a shortcode.
Ultimate Member is unable to read this shortcode and outputs the Post Title this way – [name_of_shortcode] – on the user profile page.
Forum: Plugins
In reply to: [SimpleTOC - Table of Contents Block] No Headings DetectedUnfortunately, I still can’t get it to work. Still says “no headings are found”. Tried almost all troubleshooting steps I could find. ??
Thanks anyway. Got to find an alternative… but none so far.
Hi @ethanchoi! Any update? Has this been fixed? Thanks.
Thanks @ethanchoi!