WordPress Shortcode: phpBB posts into WP post

WP_w3all 1.7.4 or >

since 2.3.6 add param/attribute wordsnum

check all others shortcodes listed under the “common how” to section

phpBB posts – WP post shortcode how to

To add a WP_w3all shortcode, and display a phpBB post into a WordPress post, choose a phpBB Post ID (note: post ID NOT Topic ID) to display, and add it into WordPress post, like this:

Change the value 1202 with the post ID you need to display.
( POST ID NOT TOPIC ID )

If you want display the post as plain text (so the bbcode will be removed by the output) use:

If you want to display with specified number of words, use the parameter/attribute wordsnum (both plaintext and wordsnum can be used together) . Note that may you have to adjust wordsnum parameter to a number of words to be retrieved that will output exactly what you want, because the count of words will include html tags

The simple bbcode parser function, display all default bbcode tags, excluded flash, attachments and email, check the list on this phpBB help page, phpBB bbcode how to
which are:

[b] [u] [i]  [list] (all lists type) [size] [color] [url] [image] [code]

added: [media] bbcode parsing (video etc embed)
useful if in phpBB installed the media embed  mod.

Note: on this phpBB installation, it is not installed the phpBB Media Embed mod to display media/video into phpBB posts, by the way, adding the [media] bbcode into a phpBB post like this:

in this case the [media] bbcode into the real phpBB post will not be parsed (because the Media Embed mod has not been installed into this phpBB) but will be parsed into the WP post, because recognized by the plugin code, and parsed by WordPress.

It can be considered as 1.0 version, that work quite fine until bbcode tags structure is respected.

Follow an output example for a phpBB postID 2249
which you can see here in phpBB:

https://www.axew3.com/w3/forums/viewtopic.php?f=13&t=566&p=2249#p2249

the shortcode used into this WP post to display the phpBB postID 2249, with bbcode formatted, will be this:

Shortcode output for post id 2249 is right here:

This is huge red text
so i want this text bold,
and after i like to display a piece of code:

<?php function test() { $foo = "local variable"; echo '$foo in global scope: ' . $GLOBALS["foo"] . "\n"; echo '$foo in current scope: ' . $foo . "\n"; } $foo = "Example content"; test(); ?>
then i want display a big text without colorize it:
WoW! i like it ... but could be better
and some lists to display:
  • The first possible answer
  • The second possible answer
  • The third possible answer
in different format
  1. The first possible answer
  2. The second possible answer
  3. The third possible answer
and i like to see the underline text
or quoted text:
this text is quoted
so a nice image:

then more strange and bad code: <test />$find = array( '~\[img\].*?\[/img\]~si', // if there links/text for the image elsewhere, remove. Done above '~(^(\r\n|\r|\n))|^\s*$~m', ......... ); and an url with text
Visit phpBB!
and an url
https://www.wordpress.org/
and more code for bbcode to be parsed: // partial bbcode regex $find = array( '~\[b\](.*?)\[/b\]~usi', '~\[i\](.*?)\[/i\]~usi', '~\[u\](.*?)\[/u\]~usi', '~\[quote\](.*?)\[/quote\]~usi', '~\[size=(.*?)\](.*?)\[/size\]~usi', ); and an image link also:



NOTE: on this phpBB example is not installed the phpBB Media Embed mod, to display video into phpBB posts, but if i add this bbcode into this phpBB post like this:

it will not be parsed into this phpBB post, because the mod has not been installed in phpBB, but will be parsed into the WP post because recognized and parsed by the WP_w3all plugin code.

you cannot add, expecting it will be parsed: an attachment, flash or email bbcode tag.
see the result of this post parsed into a WordPress post via Shortcode here: https://www.axew3.com/w3/2017/07/wordpress-shortcode-phpbb-posts-into-wp-post/

you need a more improved version of the function that do this? email me here: me@you.us
As you see was not so important to add email parsing .... (what?)

Cheers to all cool people!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.