Shortcode: display phpBB last topics grid in Wordpress with first topic's attached image
Posted: Tue May 29, 2018 7:54 am
How it work
Suppose there are forums with ID-5 and ID-9, that are sub-forums and belongs to the Forum Category with ID-1.
Then will be retrieved all latest updated topics from forums with ID-5 and ID-9, that will contain ALMOST one attachment into any of their posts. ONLY the first inserted attachment will be retrieved to be used and will display for the post/topic into the WordPress w3allastopicswithimage shortcode.
The shortcode to use is like this:
and will produce this result:
Retrieve all latest topics from sub forums which belongs to the specified Forum Cat with ID 1
Retrieve last 6 updated topics/posts
With post text
With 30 words
In two columns
With gap space between columns of 5 (after calculated in %)
or without post text
The columns_number param is useful to show more columns per row, minimum 2. If omitted, 2 by default.
The gap_columns param is an int value that is calculated after in %, if omitted the value will be 0 (0%).
Since 2.8.8 add the param
info_right_or_bottom
possible values: bottom or right
if omitted by default will display file's info on bottom of the image
or use like this to display file's info on the right
the topic need to have almost an attachment or will not be retrieved: the query search for all latest updated topics WITH ALMOST ONE ATTACHMENT ON HIS POSTS. Only the first attachment added into the topic will be retrieved to be used as image to display into the WP shortcode output. The attach can be added into any post, BUT ONLY THE ONE THAT WILL RESULT AS THE FIRST ONE ATTACHED (based on related attachments time value) will be retrieved to display. That so, could be inserted into any of topic's posts and not only into the first.
the query will return any kind of attach that is the first (time based) inserted on topic. If the first attach that belong to the topic isn't an image, then the link to download the file will display.
This is a raw version that show how to achieve the result, but could be coded in several different ways, especially about the output. The output grid is done by using an html table that look like this if two columns:
three columns will be:
and so on ...
READ inline hints on file
views/phpbb_last_topics_withimage_output_shortcode.php
This shortcode not implement avatars (so phpbb_last_topics_withimage_output_shortcode.php is more easy to be edited for own use).
While option
Retrieve posts on Last Topics Widget based on phpBB user's permissions
affect, if active option into WP_w3all plugin admin config page.
To edit the output and style the shortcode output, see file:
views/phpbb_last_topics_withimage_output_shortcode.php
NOTE: like others shortcodes files that reside into the plugin views folder or the other possible customizable files, you can activate the option
Use custom files to display Last Topics Widgets, Login Widget or Last Topics Shortcode content
in WP_w3all admin config page and copy/paste this file into the custom folder
/wp-content/plugins/wp-w3all-custom
so custom modifications done into these files, aren't overwritten when plugin update.
Suppose there are forums with ID-5 and ID-9, that are sub-forums and belongs to the Forum Category with ID-1.
Then will be retrieved all latest updated topics from forums with ID-5 and ID-9, that will contain ALMOST one attachment into any of their posts. ONLY the first inserted attachment will be retrieved to be used and will display for the post/topic into the WordPress w3allastopicswithimage shortcode.
The shortcode to use is like this:
Code: Select all
[w3allastopicswithimage cat_id="1" topics_number="6" post_text="1" text_words="30" columns_number="2" gap_columns="5"]
Retrieve all latest topics from sub forums which belongs to the specified Forum Cat with ID 1
Retrieve last 6 updated topics/posts
With post text
With 30 words
In two columns
With gap space between columns of 5 (after calculated in %)
or without post text
Code: Select all
[w3allastopicswithimage cat_id="1" topics_number="6" columns_number="2" gap_columns="10"]
The gap_columns param is an int value that is calculated after in %, if omitted the value will be 0 (0%).
Since 2.8.8 add the param
info_right_or_bottom
possible values: bottom or right
if omitted by default will display file's info on bottom of the image
or use like this to display file's info on the right
Code: Select all
info_right_or_bottom="right"
the query will return any kind of attach that is the first (time based) inserted on topic. If the first attach that belong to the topic isn't an image, then the link to download the file will display.
This is a raw version that show how to achieve the result, but could be coded in several different ways, especially about the output. The output grid is done by using an html table that look like this if two columns:
Code: Select all
<table><tbody>
<tr><td>...</td> <td>spacer</td> <td>...</td></tr>
<tr><td>...</td> <td>spacer</td> <td>...</td></tr>
etc ...
</tbody></table>
Code: Select all
<tr><td>...</td> <td>spacer</td> <td>...</td> <td>spacer</td> <td>...</td></tr>
READ inline hints on file
views/phpbb_last_topics_withimage_output_shortcode.php
This shortcode not implement avatars (so phpbb_last_topics_withimage_output_shortcode.php is more easy to be edited for own use).
While option
Retrieve posts on Last Topics Widget based on phpBB user's permissions
affect, if active option into WP_w3all plugin admin config page.
To edit the output and style the shortcode output, see file:
views/phpbb_last_topics_withimage_output_shortcode.php
NOTE: like others shortcodes files that reside into the plugin views folder or the other possible customizable files, you can activate the option
Use custom files to display Last Topics Widgets, Login Widget or Last Topics Shortcode content
in WP_w3all admin config page and copy/paste this file into the custom folder
/wp-content/plugins/wp-w3all-custom
so custom modifications done into these files, aren't overwritten when plugin update.