Wordpress: Post same blog entry to multiple pages - plugins

On my Wordpress site, I have the main blog entry page, then I have two sub blog pages. I would like to know if there is a way so that whenever authors submit a post to the main page, that same post is also posted in one of the sub blog pages. I would think that there is a plugin to do this sort of thing. The closest I have come to is this plugin, http://wordpress.org/plugins/duplicate-post/ but it does not seem that this one automates the process.
I may just edit that plugin to do it automatically, but I would like to at least try and see if there is one already out there. Ideally, I would like the plugin to have a selection of which page the blog should be added to on the edit page. Something like Add this post to Blog Page 1 or Blog Page 2 with check boxes by either page. Thanks in advance for any help.

You say you have 2 sub blog pages in which you want to have the option to display any posts taht are submited by authors. I'm thinking at a custom post meta that you can use to filter posts in the sub blog pages this way if the author wants to place the post in blog page 1 it will set the postmeta to blog1 if he wants it in blog page 2 it will set the postmeta to blog2, all you'll have to do then is to filter the posts to include postmeta blog1 in blog page 1 and blog2 in blog page 2.
something like:
$args = array('meta_query' => array(
array(
'key' => 'blogPage',
'value' => 'blog1',
'compare' => '=',
'type' => 'text'
)) // for blog page 1
and
$args = array('meta_query' => array(
array(
'key' => 'blogPage',
'value' => 'blog2',
'compare' => '=',
'type' => 'text'
)) // for blog page 2

Related

TYPO3 automatic page creation based on TCA record

I've special requirement on my project and I need help. I am using TYPO3 8.7.8. I've a custom extension to render tag labels in frontend. We can add the tags as TCA record in backend storage folder. In the TCA record, you can tag name. My requirement is, when I save the TCA record I want to create a TYPO3 page automatically with the same name as tag in a specific position. Everytime when I add a TCA record, I need to create corresponding page automatically. Is this possible? I can use hook while saving TCA. But is there any function to create pages automatically?
After automatic page creation, I want to insert a plugin content element in that page with a specific flexform value automatically. I know this is a strange requirement, but I would like to know if it is possible or not.
Exactly, you'd trigger a hook on saving and then as next step you can use the data handler to generate the new page (and possible content).
To create the page and content, use something like the following data structure
$data = [
'pages' => [
'NEW_1' => [
'pid' => 456,
'title' => 'Title for page 1',
],
],
'tt_content' => [
'NEW_123' => [
'pid' => 'NEW_1',
'header' => 'My content element',
],
],
];
Then call the datahandler with that structure:
$tce = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler');
$tce->stripslashes_values = 0;
$tce->start($data, []);
$tce->process_datamap();
Find out more in the docs at
https://docs.typo3.org/typo3cms/CoreApiReference/ApiOverview/Typo3CoreEngine/Database/Index.html#data-array
and
https://docs.typo3.org/typo3cms/CoreApiReference/ApiOverview/Typo3CoreEngine/UsingDataHandler/Index.html
Are you sure you need additional pages?
In general your problem sounds like you need one page where the plugin is inserted and where the plugin in dependency of an url-parameter (which can be converted with realurl into a path segment) shows only information depending of the selected record (tag).
If no tag is selected you can output a list with all available tags as a menu to navigate to all possible tags.
With a little effort (less than writing a hook like intended) you can add all tags to your menu.

Typo3 RealUrl: add term to pagination url

I wrote a press release plugin listing several releases using the paginate widget. Using RealUrl the URL of the listing site looks like this: www.mysite.com/press/2/
Is it possible to add another term to the page parameter? So it looks like this: www.mysite.com/press/page-2/
I would also need this for two languages.
This is part of my RealUrl configuration:
$TYPO3_CONF_VARS['EXTCONF']['realurl']['_DEFAULT'] = array(
'fixedPostVars' => array(
'127' => array( // Press release overview
array(
'GETvar' => 'tx_press_releaselist[#widget_0][currentPage]',
)
),
)
);
A possible solution would be to use a valueMap. Only downside would be that you would provide every value. So if you expect 100 pages, you need to add those 100 numbers to the realurl configuration.

realURL within News System extension

I would like to have frendly URLs in news single post instead of all those hashtags, procent, question marks etc.
I have tried to follow this article but it doesn't work.
Normal pages have friendly URLs.
I am using Typo3 7.2.0 and News System 3.2.0
Any ideas? Thanks
RESOLVED
This worked TYPO3 news system and RealURL
Of course that sample doesn't work as it's written for tt_news ext. You should use sample from official News' doc instead.
Note that you can skip controller and action parts of URL by adding this to your TS:
plugin.tx_news.settings.link.skipControllerAndAction = 1
In such case you will also need to remove/comment these parts from your realurl_conf:
array(
'GETvar' => 'tx_news_pi1[action]',
),
array(
'GETvar' => 'tx_news_pi1[controller]',
),

TYPO3 TCA/Flexform Link Wizard: How to display page name in the backend?

I created a custom content element using a fluid template for the frontend and a flexform xml file for the backend. The element has a link input field that makes use of the link wizard as explained in this question:
How can i make a Link input Field in TCA
This works fine, but when I select a page from the page tree in the wizard, the input field displays the page ID (for example a "4"). If I use the same (?) wizard within content elements that vanilla TYPO3 provides (for example the "shortcut" page type), the backend shows the name of the page in the link input field, not the ID.
Is there an easy way to bring that functionality to my own element?
Remark: In my case, I don't use the PHP array writing style, but the XML one. So what would be 'config' => array(...) in the PHP array is ... in my XML Flexform.
This is standard behavior, see for an example Link field under the Header it also uses uid of the page, reason is simple: it allows to choose a page, but also external URL, email address or file reference - therefore it doesn't use page's title but its uid.
Second sample - shortcut to page definitely allows you to store only pages records, so it can render its title on the list - but doesn't allow you to mix different kinds of links.
If your ext will store always one type of link (ie. references to pages) you can use TCA field of type Group as showed in documentation
'storage_pid' => array(
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_tca.xlf:storage_pid',
'config' => array(
'type' => 'group',
'internal_type' => 'db',
'allowed' => 'pages',
'size' => '1',
'maxitems' => '1',
'minitems' => '0',
'show_thumbs' => '1',
'wizards' => array(
'suggest' => array(
'type' => 'suggest'
)
)
)
),

does facebook post api fied description support html

Will the description field support html tags
$facebook->api("/me/feed", "post", array(
message => $des,
picture => $img,
link => $link,
caption => $title ,
description =>$desc
));
I would looking to have description as
$desc="hai to <strong>All</strong><br>I am on the nextline";
Thanks in advance
No, facebook doesn't interpret formatting in the description field (simply shows as them you send it), and you can't place newlines. If you want to add extra links to the message you can use the properties field of the Post object.