chrisauthor
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Post Editor Initial Load Slow without CacheI did search github (and wordpress.org), but most issues refer to the editor being slow during usage (as I mentioned in my original post). Issue #51608 (which I also found earlier) is about the site editor, not the post editor.
Anyway, most other responses (e.g. on the Bing search you suggested…) offer the same generic non-solutions (like “use classic editor”).
I’ll mark this as resolved, because I realize I can’t find any answers. There are 583 things going wrong with WordPress, and this is one of them. I guess I just have to accept it.
Still, thanks for the effort.
Forum: Developing with WordPress
In reply to: Can the WordPress API run inside fetched posts?Yeah, the script is good. I cut the content of <script>, pasted it in the console in the Developer Tools, and it works, with the caveat that it doesn’t fire immediately (I assume because of the
document.addEventListener("DOMContentLoaded", function(event) {foo();});block). But pasting the content of <script> and then manually callingfoo();works as intended.So, it seems there is something else at play here.
- This reply was modified 2 years, 5 months ago by chrisauthor.
Forum: Developing with WordPress
In reply to: Can the WordPress API run inside fetched posts?Thanks for the reply. If you mean something like the following, I tried that but no luck (the <script> tag shows up in the DOM, as before, but isn’t running):
fetch(apiUrl) .then((response) => response.json()) .then((data) => { const postContent = data[0].content.rendered; const tempDiv = document.createElement('div'); tempDiv.innerHTML = postContent; const scriptElements = tempDiv.getElementsByTagName('script'); for (let i = 0; i < scriptElements.length; i++) { const script = scriptElements[i]; const newScript = document.createElement('script'); newScript.innerHTML = script.innerHTML; document.head.appendChild(newScript); } postContentDiv.innerHTML = tempDiv.innerHTML; })Is there some core security setting relevant to the WordPress API that doesn’t allow running scripts? I’m quite puzzled by this.
Forum: Developing with WordPress
In reply to: Can the WordPress API run inside fetched posts?(For some unfathomable reason, it seems the interface sanitizes “<script>” added to the post title, which should read: “Can the WordPress API run <script> inside fetched posts?”)
This will not go away on its own if the permissions of the file wp-load.php were (for whatever reason, from whatever plugin etc) changed.
If you want to change it yourself, it’s trivial: Go to the cpanel file manager, locate the wp-load.php file (it should be in the root directory of your wordpress installation), and notice the number under the “permissions” column. If it’s something like 0444, it means it’s read-only (even to you).
If there is a zero as a first number, ignore it. The 2nd number means owner permissions (you), the 3rd means group permissions (if you use it), and the 4th means everyone else browsing the system.
To make the warning go away, right click the file, select “change permissions”, and then add “write” to your permissions, so that the number changes to 0644. Go back to the Site Health, repeat the check, and the warning will be gone.
- This reply was modified 5 years, 1 month ago by chrisauthor.
@mazedulislamkhan Thanks for the info!
@alukerowley and @tkyle, do you have an update for this? Does it work for you now and did you have to downgrade to 14.8.1? Obviously this only affects part of the users, otherwise there would be many more messages, but it’s important to know how/why, otherwise this will never get fixed.
cc @priscillamc
I have the same problem and have already reported it on GitHub: https://github.com/Yoast/wordpress-seo/issues/15987
Downgrading to 14.8.1 solves the issue, though of course that’s only a temporary solution.
Same issue here. I do use Bluehost — their support says it’s a known JetPack issue, having to do with the newest WordPress update.
- This reply was modified 5 years, 7 months ago by chrisauthor.
Forum: Fixing WordPress
In reply to: Change Date Format on Admin PanelThanks for the reply. That’s a pretty short-sighted design – is it not conceivable that someone wants to use English as a language but with a European-style date format?
Anyway, thanks for your help.
- This reply was modified 6 years, 10 months ago by chrisauthor.
I can’t comment on the specific theme you mentioned, but the general idea should be the same. If you’re not particularly experienced with php, remember to keep copies of all the files you experiment with. If there is a support group related to your theme, perhaps you can get more help there
I can’t comment on this code, but FWIW I’m using jetpacks comments as well. So what I described should work – though you never know I suppose
And of course, in its infinite wisdom, wordpress.org removed my link… Second attempt. Here’s an example:
http://blog.homeforfiction.com/2018/01/03/authorial-voice-develop-style-fiction/Hi, I’ll try to make it more clear. If it’s still not, don’t hesitate to ask for more details.
(A word of warning, first: to some extent this could be theme-related, so different themes might be structured differently. Always work on a child theme or, in any case, so that you have a backup of the original files in case something goes wrong)The two files I changed were
1) functions.php – this is usually found in the root folder of your theme
2) loop.php – if you can’t find its location, there should be a reference to loop.php inside single.php (which is also in the root folder). In my case the line was<?php get_template_part( 'includes/loop', 'single' ); ?>, which means loop.php was to be found in the folder named “includes”.In functions.php, I added the following code (somewhere in the middle, it’s not very important, as long as it’s within the tags), which removes the Jetpack Related Posts module
function jetpackme_remove_rp() { if ( class_exists( 'Jetpack_RelatedPosts' ) ) { $jprp = Jetpack_RelatedPosts::init(); $callback = array( $jprp, 'filter_add_target_to_dom' ); remove_filter( 'the_content', $callback, 40 ); } } add_filter( 'wp', 'jetpackme_remove_rp', 20 );Then I went to loop.php and added the jetpack-related-posts shortcode
<?php echo do_shortcode( '[jetpack-related-posts]' ); ?>right below the comments template so that it read like that:<?php comments_template(); ?> <?php echo do_shortcode( '[jetpack-related-posts]' ); ?>Now the related posts show as they should, below the comments. Here’s an example:
- This reply was modified 8 years, 2 months ago by chrisauthor.
Forum: Developing with WordPress
In reply to: Way to Allow User to Switch Page Colors?This worked! Thanks for your efforts 🙂