sheriffderek
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: preg_replace(): Passing null to parameter…kses.php on line 1805Awesome! Thank you for the lead @threadi !!!
That helps me understand how to deal with it.
$teaser =
get_field('teaser')
?
wp_kses_post( get_field('teaser') )
:
"<p>Default</p>"
;Also – I might use a wrapper function like this:
function get_safe_field(string $fieldName): string {
$field = get_field($fieldName);
return !empty($field) ? wp_kses_post($field) : "";
}
$teaser = get_safe_field('teaser') ?: "<p>Default</p>";Forum: Fixing WordPress
In reply to: preg_replace(): Passing null to parameter…kses.php on line 1805Adding to this —
I’m in a fresh install and used
wp_kses_post()$teaser = wp_kses_post( get_field('introduction') ) ?: "<p>There's no teaser yet. Help us write one!</p>";And then get this depreciation warning:
Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /Users/sheriffderek/Sites/wordpress-exploration-project/wp-includes/kses.php on line 1805
So, something in
wp_kses_post()is usingpreg_replace()Gotcha! Thanks. I thought there might be a flag “show__duplicates” or something smooth. : )
I went with this:
global $post; foreach ($customLessonPlanIdArray as $id) { $post = get_post($id); setup_postdata( $post ); }But I didn’t feel very in control of it. In my case – there’s only one type of post on the page, but I’m not familiar with the global post object. It seems like a classic copy-paste job! But it works. : )
- This reply was modified 4 years, 3 months ago by sheriffderek.
It seems to take the $vacation, $sunday, and $practics “lesson: posts – and put them in only once… and at the end of the list.
That’s wonderful!
Thank you for addressing it. I run a design and ‘coding’ school – and so, I didn’t want any errors in our console! Now we’re clear!!!! ❤️
Forum: Fixing WordPress
In reply to: Stop admin-bar.js from loading on front-end@dd32 Excellent! I’m embarrassed I didn’t check. I just assumed it was the ol admin bar! I’ll take it up with them. Thanks!
Forum: Reviews
In reply to: [301 Redirects & 404 Error Log] plugin does not remove database tables…These are – real things… but 1 star? That’s not how ratings work. This is a 4/5 start review. It does its job… but not A+ – but it’s not 1 star… banners are annoying… but – you didn’t pay anything for it. You have to weigh the trade-offs, right?
Forum: Fixing WordPress
In reply to: How is this author link gathered in metadata?OK. I definitely started with zero files – and built the theme up myself, so – there’s no mysterious stuff in there. I’ll turn off all the plugins do some tests. The only other thing I can think of – is that somehow – the rich data is coming from the JSON API or something. Thank you. I’ll report back if I find any leads.
Forum: Fixing WordPress
In reply to: How is this author link gathered in metadata?So, just to be clear – this website is not built with any pre-made theme – and does not extend any theme. Are the modules you are talking about “plugins?” Or are they part of the core? This site doesn’t use any plugin that I could imagine builds any structured data. I am not using Yoast or anything like that. If it’s not in the HTML – then where could it possibly come from?
I’m using utility type plugins:
- Limit Login Attempts Reloaded
- WP Migrate DB Pro
- Disable Comments
- Custom Post Type UI
- Classic Editor
- Advanced Custom Fields PRO
- ACF to REST API
Forum: Fixing WordPress
In reply to: How is this author link gathered in metadata?The page is the ‘index’ page.
<?php if ( is_page('landing') ) { include('templates/pages/welcome.php'); } ?>You should ask in the dedicated support channel for whichever module is generating the structured data for your site
Can you tell me more about this? I have never thought of WordPress in this way. I only build very basic custom themes and use very little of the framework defaults.
I suppose the ‘sheriffderek’ user did create that page. And checking the page-specific metadata (ACF) – that does show [1] and clears that up. Thank you. That makes sense to me, but I don’t see anything in the generated HTML to tell that story.
- This reply was modified 6 years ago by sheriffderek.
RE:
what if each lesson had a custom field specifying its previous lesson ID
This is interesting. I think that the order of the lessons may shift over time – but this would simplify those changes. I’ll have to try some things out and see what happens.
@jdembowski – (gotcha – that makes sense) I was just trying to make it less ugly : )
@bcworkz – The only problem with the relative time-stamps – is that lessons will be changed and added over time. If I needed to splice in a lesson – then I would have to change hundreds of dates. But’s that’s close to where I’m going. I guess the criteria is that the ‘lesson’ loop/query – gets an array of lessons based on their assiciated ‘unit’ – and prints that out. The scope doesn’t know about the bigger picture – so, I could have another loop on that page for all of the lessons – and gather some data there – and then maybe match the $ids to figure out their relative order…
Forum: Fixing WordPress
In reply to: Add parent element for WP_DEBUG infoThanks for the answer. Placement in the context makes sense. It would still be cool to have each area or errors in a parent div or something.
: /
- This reply was modified 6 years, 11 months ago by sheriffderek.
Forum: Plugins
In reply to: [ACF Code Field] Height of fieldFrom my experience, tt changes height as you type, which is nice – because it stays out of your way.
Forum: Developing with WordPress
In reply to: Use query parameters in templatePerfect!