maccast
Forum Replies Created
-
Forum: Plugins
In reply to: [User Login History] show login failed new users (admin) ?Hey @fimo66 how did you solve this? I’m having the same issue where we use a custom login form but I don’t see any “failed” login attempts with the plugin-in
Forum: Plugins
In reply to: [ReOrder Posts within Categories] Apply Sort Order to custom queryHey, thanks for the reply and the explanation. I do understand the mysql order/limit syntax. Sorry, I just really didn’t have enough background with the code to understand how it was working in this context. Yes, I am looping over my results, but the issue is those results, at least for me, still don’t seem to be sorted in the correct order. It is entirely possible I’ve made an error someplace else in my code and I will look into this. I really appreciate your help. Thank you.
Forum: Plugins
In reply to: [ReOrder Posts within Categories] Apply Sort Order to custom queryYes, but as you can see it wouldn’t work because for some odd reason it has a
ASC LIMIT 0, 1
on it. Meaning there is nothing to “order” since it’s only one result. That’s why i=I wasn’t sure it was the correct query. If I remove thelimit
it does appear to return the correct items.- This reply was modified 7 years, 1 month ago by maccast.
Forum: Plugins
In reply to: [ReOrder Posts within Categories] Apply Sort Order to custom queryNot sure exactly what I’m looking at, buthere is the full SQL query I’m seeing:
SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts LEFT JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) INNER JOIN wp_reorder_post_rel ON wp_posts.ID = wp_reorder_post_rel.post_id and incl = 1 WHERE 1=1 AND ( wp_term_relationships.term_taxonomy_id IN (29) ) AND wp_posts.post_type = 'menu-item' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled' OR wp_posts.post_status = 'private') AND wp_reorder_post_rel.category_id = '29' GROUP BY wp_posts.ID ORDER BY wp_reorder_post_rel.id ASC LIMIT 0, 1
There is an
INNER JOIN wp_reorder_post_rel ON wp_posts.ID = wp_reorder_post_rel.post_id
, but when the page is rendered the items are not displayed in the custom order.- This reply was modified 7 years, 1 month ago by maccast.
Forum: Plugins
In reply to: [ReOrder Posts within Categories] Apply Sort Order to custom queryOk, well I’m maybe a bit confused then because you can see from my code above that I’m using
WP_Query
and I am NOT settingsuppress_filters=true
, but the results I’m getting are not being sorted in the custom order. Do you know why that might be?Forum: Plugins
In reply to: [WooCommerce] Broken Dropdown MenusWe are also having this issue and we use Subscriptions. @cipherdicer442, did you say the plug-in authors are saying not to upgrade? Do you have a link or more information?
Forum: Plugins
In reply to: [Publish To Apple News] Missing ‘Read Full Story’ LinkSorry for the double post, but I can’t seem to delete now.
Here’s the missing screenshot:
Forum: Plugins
In reply to: [Publish To Apple News] Missing ‘Read Full Story’ LinkSo we came up with a solution for this that seems to work. I wish I had more control over the display formatting, but at least this bring back the missing functionality. The solution involves making two filter calls. We put these in a custom theme plug-in, but they could also be added to the
functions.php
file of your theme.The first call uses the
apple_news_generate_json
filter. In it I add a couple oftextStyles
JSON entries to the top level properties on main JSON object. These will be used to apply in-line text styles to the markdown code which you’ll see later. See Apple’s docs on the textStyle for more info. Here is the code:function add_text_styles_to_apple_news($json, $content_id) { /* Add custom inline styles */ $json['textStyles'] = array( 'read-original-url' => array( 'fontName' => 'AvenirNext-Regular', 'fontSize' => 14, 'textColor' => '#0a5785', ), 'read-original-link' => array( 'fontName' => 'AvenirNext-Bold', 'fontSize' => 14, 'textColor ' => '#666', ) ); return $json; } add_filter( 'apple_news_generate_json', 'add_text_styles_to_apple_news', 10, 2 );
This defines two new
textStyles
:read-original-url
andread-original-link
. These can be used later using Apple News’ inline text style. The basic format isExample of [text to be styled]{read-original-url}
where the text you want to apply the style to is in the square braces and the style to apply to it is in the curly braces (in this example theread-original-url
style which we defined with the filter call above).The second filter call we used is
apple_news_exporter_content_pre
. In here we are simply appending the “Read Original” text and link to the content before it’s parsed by the Apple News plugin. Here’s the code:function add_content_to_apple_news($content, $ID) { $post = get_post($ID); //create the Read Full Story link and apply the styles $link = sprintf('<p>[Read Original:]{tmo-read-original-link} [[%s](%s)]{read-original-url}</p>', $post->post_title, get_permalink($ID) ); $content .= $link; //append link to content return $content; } add_filter( 'apple_news_exporter_content_pre', 'add_content_to_apple_news', 10, 2 );
This is fairly straight forward. We grab the post object using the
$ID
and then build out our link content and append it to$content
and return it.That’s it. For us this is working well. In our case the result looks like this
Forum: Plugins
In reply to: [Publish To Apple News] Missing ‘Read Full Story’ LinkNot sure what happened, but I had posted out solution to this, but when I tried to add a screenshot the whole post disappeared. I attempted to re-post it, but nothing is happening. In case it never shows back up here is a gist with the same content: https://gist.github.com/phylaxis/db31ae99fc5670235d810311fb09eddb
Forum: Plugins
In reply to: [Publish To Apple News] Missing ‘Read Full Story’ LinkSo we came up with a solution for this that seems to work. I wish I had more control over the display formatting, but at least this bring back the missing functionality. The solution involves making two filter calls. We put these in a custom theme plug-in, but they could also be added to the
functions.php
file of your theme.The first call uses the
apple_news_generate_json
filter. In it I add a couple oftextStyles
JSON entries to the top level properties on main JSON object. These will be used to apply in-line text styles to the markdown code which you’ll see later. See Apple’s docs on the textStyle for more info. Here is the code:function add_text_styles_to_apple_news($json, $content_id) { /* Add custom inline styles */ $json['textStyles'] = array( 'read-original-url' => array( 'fontName' => 'AvenirNext-Regular', 'fontSize' => 14, 'textColor' => '#0a5785', ), 'read-original-link' => array( 'fontName' => 'AvenirNext-Bold', 'fontSize' => 14, 'textColor ' => '#666', ) ); return $json; } add_filter( 'apple_news_generate_json', 'add_text_styles_to_apple_news', 10, 2 );
This defines two new
textStyles
:read-original-url
andread-original-link
. These can be used later using Apple News’ inline text style. The basic format isExample of [text to be styled]{read-original-url}
where the text you want to apply the style to is in the square braces and the style to apply to it is in the curly braces (in this example theread-original-url
style which we defined with the filter call above).The second filter call we used is
apple_news_exporter_content_pre
. In here we are simply appending the “Read Original” text and link to the content before it’s parsed by the Apple News plugin. Here’s the code:function add_content_to_apple_news($content, $ID) { $post = get_post($ID); //create the Read Full Story link and apply the styles $link = sprintf('<p>[Read Original:]{tmo-read-original-link} [[%s](%s)]{read-original-url}</p>', $post->post_title, get_permalink($ID) ); $content .= $link; //append link to content return $content; } add_filter( 'apple_news_exporter_content_pre', 'add_content_to_apple_news', 10, 2 );
This is fairly straight forward. We grab the post object using the
$ID
and then build out our link content and append it to$content
and return it.That’s it. For us this is working well. In our case the result looks like this:
- This reply was modified 7 years, 11 months ago by maccast.
Forum: Plugins
In reply to: [Publish To Apple News] Missing ‘Read Full Story’ LinkI was digging into a solution for this and trying to use some of the filters. Using the
apple_news_exporter_content_pre
filter it’s possible to add the link and content to the end of the body, but there doesn’t seem to be nay way to control the styles or formatting to match the original look.I then saw the
apple_news_initialize_components
would that work for adding additionalrole:body
elements and styles?Great. Thank you for your replies and the info. I’ll keep an eye on the GitHub.
Is there possibly a workaround using a regex and a hook on the Publicize message?
Hey @jeherve, I have a similar but I think slightly different need. I need to override the URLs that are used in the Publicize posts that go out when you publish an article with Publicize active. Would the filter mentioned here work for that or is there a different one?
Forum: Plugins
In reply to: [Restrict Author Posting] Restrict the custom post type categories?I would also be interested in this functionality. Has anyone been able to figure out how to do this?