How to autopublish post entered thru Frontend Submission with all the fields?
Support › MB Frontend Submission › How to autopublish post entered thru Frontend Submission with all the fields?
- This topic has 12 replies, 2 voices, and was last updated 6 years, 11 months ago by
Anh Tran.
-
AuthorPosts
-
June 2, 2018 at 8:04 PM #9993
EddyPiV
ParticipantHi,
What I want to achieve is that people can register on my website and fill out their profile - a whole buch of fields - I am using Frontend Submission for that. Subsequently, the post plus all these fields become visible for the visitors of my website without human intervention.
To show the fields in the front end, it is my understanding that I can do that using the [rwmb_meta meta_key="field_id"] shortcode.
I.e. for each field I have to specify a line with the label and this shortcode.
This is a lot of shortcodes that in one way or the other should be added to the text of the post (without human intervention).
Is there an easy way to do that?The way I am trying now is to use the Text Blocks plugin from Hal Gatewood. That way, only 1 shortcode needs to be included in the text of the post.
This works nicely.
Question is: how to include that shortcode (e.g. [text-blocks id="showfields"]) in the text of the post?I want to show the fields nicely, so I am using a table for this purpose, with the TablePress plugin.
Here something weird starts...
There are 2 posts with different field values. When I use the rwmb_meta shortcode directly in the textblock, the correct values are shown for each post. But when I use the same rwmb_meta shortcode in TablePress table, 1 set of values is shown for both posts.Any suggestion how to resolve?
Any suggestion if what I want to achieve can be done in a simpler way?June 5, 2018 at 2:01 PM #10046EddyPiV
ParticipantUpdate on this issue: I am no longer using TablePress, due to the problem I mentioned.
Instead I am using Shortcodes Ultimate plugin for the design of the output, and it works great.
So, to summarize:
- I am using the shortcodes from Shortcodes Ultimate plugin for the design
- I am defining the design with the Text Blocks plugin
- The shortcode for this text block needs to be included in the text of the post (at the end of it).Now, only the following question from above issue remain outstanding:
- How to (automatically) include the shortcode from the Text Blocks plugin (e.g. [text-blocks id=”showfields”]) in the text of the post?June 5, 2018 at 9:14 PM #10054Anh Tran
KeymasterHello, the last question can be done with
the_content
filter. Please see the docs and example here.June 6, 2018 at 2:13 AM #10064EddyPiV
ParticipantWhere should I add this filter? I have added the following to single.php:
<?php add_filter( 'the_content', 'text-blocks id=”showfields”]' ) ?>, but without success.June 6, 2018 at 4:30 PM #10079Anh Tran
KeymasterYou should add that filter to your
functions.php
file, something like this:add_filter( 'the_content', function( $content ) { if ( is_single() ) { $content .= do_shortcode( '[text-blocks id="showfields"]' ); } return $content; } );
June 6, 2018 at 4:52 PM #10080EddyPiV
ParticipantAha. Thanks so much for your help.
I have added it to functions.php. It results in a 503 Service Unavailable error (while trying to use an ErrorDocument to handle the request).
Any idea?June 7, 2018 at 3:30 PM #10091Anh Tran
KeymasterWhich PHP version are you using? The snippet above requires PHP 5.3. Also, can you make a screenshot of the functions.php file after inserting?
June 7, 2018 at 3:42 PM #10092EddyPiV
ParticipantThe PHP version on the server is 5.6.30.
I have uploaded functions.php here: https://1drv.ms/f/s!AiZg1q2e9vdxhBlxbs_Mz30DdS2c
June 7, 2018 at 4:43 PM #10095Anh Tran
KeymasterI've just tested the code and there's no error:
https://i.imgur.com/3IJnOek.png
I don't have the Text Blocks plugin, so it just show the shortcode. If you have it installed, then the content of the shortcode will be parsed and shown automatically.
June 7, 2018 at 4:58 PM #10096EddyPiV
ParticipantYou are right. If I deactivate the Text Blocks plugin, it is shown as you stated. But once I activate the plugin again, the 503 Service Unavailable error is back.
I have changed the contents of my text block to just a single line of text, but same problem.
Hence, the problem is the plugin.Before I start asking for support from the plugin developer, just a final question.
I am using this text block plugin to display all the fields in the frontend in the order/layout that I want.
Is there another, more appropriate way of displaying the fields in frontend?June 7, 2018 at 5:19 PM #10098Anh Tran
KeymasterMaybe you just write some PHP code to loop through all the fields and show them. Or I see you already use Shortcodes Ultimate, which allows you to create HTML shortcode. You can use it to display fields like:
Field 1: [rwmb_meta meta_key="field-1"]<br> Field 2: [rwmb_meta meta_key="field-2"]<br> ...
As long as it supports running
rwmb_meta
shortcode, it will work.June 7, 2018 at 5:22 PM #10099EddyPiV
ParticipantOK, thanks for all your help. Consider this solved.
June 8, 2018 at 8:13 AM #10106Anh Tran
KeymasterFYI: LFFprop has found a solution for this and here is his commend, in case someone needs it:
I managed to sort it all out.
I am no longer using the Reusable Text Block plugin to display all fields after the post data. Instead I have installed the After Content Widget plugin. This adds a widget area right after the post content. In there I use the Visual editor to create the layout and show all the fields.
-
AuthorPosts
- The topic ‘How to autopublish post entered thru Frontend Submission with all the fields?’ is closed to new replies.