Custom Template Not Showing since v5.10.2
-
Thanks in advance.
I have been using a custom template since ever. Beginning with the version *after* v5.10.2 this stopped working on my website.
I tried your own custom templates and different versions of WP & YARPP – to no success.
Regardless of which custom template I use, it always defaults to the “Theme: List”.
Any ideas?
-
– would it be possible to share access so we can investigate? This seems to be specific to you as we haven’t received any other reports of this (>5.10.2 has been out for ~5 months) – jay at yarpp dot com
– when you select a custom template in the admin UI and save, does the correct theme remain selected on refresh?Thanks for your quick response.
Unluckily I can’t give you access to the installation ??
It does save right, also the call comes from within the template.
I tried different calls…Right now using this one:
yarpp_related();Do I need to change that?
Hi @delamar, sorry to hear you’re having this trouble. I suspect this has to do with some file sanitization we stared doing in YARPP 5.10.0.
What is the name of the custom template file you’ve tried to use? It sounds like YARPP doesn’t think it’s valid and so is falling back to the default.
Hey, Michael.
Thank you for your response.
The file name is:
yarpp-template-footer.phpBut I also tried the ones from your install:
yarpp-template-simple.phpThanks @delamar, yes those look like they should be ok (if they had a space or special characters in the name that would have caused the problem you’re having).
Could you please post the YARPP debug info here? That might have a clue for us…
To send WordPress generic debug info:
1. on WordPress 5.1 and earlier, install the Health Check & Troubleshooting plugin; on WordPress 5.2 and later skip this
2. Go to the WordPress admin dashboard
3. under “Tools”
4. click “Site Health”
5. click “Info” tab
6. click “Copy info to clipboard”
7. paste it
Here’s a video: https://drive.google.com/file/d/1QWKgzJ65JKScDkoBIcqqEDulEMjMtfTV/viewTo send us YARPP debug info,
1. From WordPress admin dashboard, under “Settings” click “YARPP”
2. Click “Help” in the top-right corner
3. Click “Optional Data Collection” tab on the left
4. Copy all the monospaced text
Here’s a video: https://drive.google.com/uc?id=1Nw3IaXhs_7RTlUdzB5iTeBcymwcIJObyThanks again for your help.
WP
### wp-core ### version: 5.6.2 site_language: de_DE user_language: de_DE timezone: Europe/Berlin permalink: /%category%/%postname%-%post_id%/ https_status: true multisite: false user_registration: 1 blog_public: 1 default_comment_status: open environment_type: production user_count: 161 dotorg_communication: true ### wp-paths-sizes ### wordpress_path: /var/***/httpdocs wordpress_size: 24,54 GB (26347776684 bytes) uploads_path: /var/***/httpdocs/wp-content/uploads uploads_size: 52,45 GB (56314835772 bytes) themes_path: /var/***/httpdocs/wp-content/themes themes_size: 1,35 MB (1420743 bytes) plugins_path: /var/***/httpdocs/wp-content/plugins plugins_size: 123,21 MB (129192223 bytes) database_size: 1,08 GB (1163760854 bytes) total_size: 78,19 GB (83956986276 bytes) ### wp-dropins (2) ### advanced-cache.php: true db.php: true ### wp-active-theme ### name: delamar v7.17 (delamar_v717) version: 7.17 author: Chef author_website: https://www.delamar.de/ parent_theme: none theme_features: core-block-patterns, post-thumbnails theme_path: /var/***/httpdocs/wp-content/themes/delamar_v717 auto_update: Deaktiviert ### wp-mu-plugins (1) ### InfiniteWP - Client Loader: author: Revmakx, version: (undefined) ### wp-plugins-active (40) ### AddQuicktag: version: 2.5.3, author: Frank Bültge, Automatische Aktualisierungen deaktiviert Admin Columns: version: 4.2.5, author: AdminColumns.com, Automatische Aktualisierungen deaktiviert Adminimize: version: 1.11.7, author: Frank Bültge, Automatische Aktualisierungen deaktiviert Akismet Anti-Spam: version: 4.1.9, author: Automattic, Automatische Aktualisierungen deaktiviert Author Image: version: 4.9.3, author: Denis de Bernardy & Mike Koepke, Automatische Aktualisierungen deaktiviert BJ Lazy Load: version: 1.0.9, author: Bj?rn Johansen, Aron Tornberg, angrycreative, Automatische Aktualisierungen deaktiviert Broken Link Checker: version: 1.11.15, author: WPMU DEV, Automatische Aktualisierungen deaktiviert Classic Editor: version: 1.6, author: WordPress Contributors, Automatische Aktualisierungen deaktiviert CMS Tree Page View: version: 1.6.4, author: Jon Christopher, Automatische Aktualisierungen deaktiviert Contact Form 7: version: 5.4, author: Takayuki Miyoshi, Automatische Aktualisierungen deaktiviert Contextual Related Posts: version: 3.0.7, author: WebberZone, Automatische Aktualisierungen deaktiviert Enable Media Replace: version: 3.5.0, author: ShortPixel, Automatische Aktualisierungen deaktiviert InfiniteWP - Client: version: 1.9.4.8.2, author: Revmakx, Automatische Aktualisierungen deaktiviert NextScripts: SNAP Pro Upgrade Helper: version: 1.5.10, author: NextScripts, Automatische Aktualisierungen deaktiviert NextScripts: Social Networks Auto-Poster: version: 4.3.20, author: NextScripts, Automatische Aktualisierungen deaktiviert No Self Pings: version: 1.1.5, author: David Artiss, Automatische Aktualisierungen deaktiviert Paid Downloads Pro: version: 3.64, author: Halfdata, Inc., Automatische Aktualisierungen deaktiviert Redirection: version: 5.0.1, author: John Godley (latest version: 5.1.1), Automatische Aktualisierungen deaktiviert SearchWP: version: 3.1.16, author: SearchWP, LLC, Automatische Aktualisierungen deaktiviert SearchWP Boolean Query: version: 1.4.2, author: SearchWP, Automatische Aktualisierungen deaktiviert SearchWP Custom Results Order: version: 1.3.5, author: SearchWP, Automatische Aktualisierungen deaktiviert SearchWP German Stemmer: version: 1.0.2, author: SearchWP, LLC, Automatische Aktualisierungen deaktiviert SearchWP Metrics: version: 1.4.0, author: SearchWP, Automatische Aktualisierungen deaktiviert SEO Smart Links Business: version: 1.8.8, author: Vladimir Prelovac, Automatische Aktualisierungen deaktiviert ShortPixel Image Optimizer: version: 4.21.2, author: ShortPixel, Automatische Aktualisierungen deaktiviert Site Kit by Google: version: 1.29.0, author: Google (latest version: 1.30.0), Automatische Aktualisierungen deaktiviert SSC Auto-Notify: version: 0.0.9, author: Carlos San Segundo, Automatische Aktualisierungen deaktiviert SSC CPT Testberichte: version: 4.02, author: Carlos San Segundo, Automatische Aktualisierungen deaktiviert SSC Custom Taxonomies: version: 1.03, author: Carlos San Segundo, Automatische Aktualisierungen deaktiviert SSC delamar Elementor: version: 0.4, author: Carlos San Segundo, Automatische Aktualisierungen deaktiviert User Role Editor: version: 4.59, author: Vladimir Garagulya, Automatische Aktualisierungen deaktiviert W3 Total Cache: version: 2.1.2, author: BoldGrid, Automatische Aktualisierungen deaktiviert Wordfence Security: version: 7.5.2, author: Wordfence, Automatische Aktualisierungen deaktiviert WP Insert Content: version: 1.0.0, author: keesiemijer, Automatische Aktualisierungen deaktiviert WP Mail SMTP: version: 2.7.0, author: WPForms, Automatische Aktualisierungen deaktiviert Yet Another Related Posts Plugin (YARPP): version: 5.10.2, author: YARPP (latest version: 5.17.0), Automatische Aktualisierungen deaktiviert Yoast SEO: version: 16.1.1, author: Team Yoast, Automatische Aktualisierungen deaktiviert Yoast SEO: News: version: 12.6, author: Team Yoast (latest version: 12.7), Automatische Aktualisierungen deaktiviert Yoast SEO: Video: version: 13.7, author: Team Yoast (latest version: 13.8), Automatische Aktualisierungen deaktiviert Yoast SEO Premium: version: 16.0.3, author: Team Yoast (latest version: 16.1), Automatische Aktualisierungen deaktiviert ### wp-plugins-inactive (13) ### Activity Log: version: 2.6.1, author: Activity Log Team, Automatische Aktualisierungen deaktiviert Advanced Database Cleaner PRO: version: 3.1.0, author: Younes JFR., Automatische Aktualisierungen deaktiviert Better Search Replace: version: 1.3.4, author: Delicious Brains, Automatische Aktualisierungen deaktiviert Copy Or Move Comments: version: 5.0.1, author: biztechc, Automatische Aktualisierungen deaktiviert P3 (Plugin Performance Profiler): version: 1.5.4, author: GoDaddy.com, Automatische Aktualisierungen deaktiviert PayPal File Download: version: 2.0.1, author: Mark Bao / YesPlugins, Automatische Aktualisierungen deaktiviert Regenerate Thumbnails: version: 3.1.5, author: Alex Mills (Viper007Bond), Automatische Aktualisierungen deaktiviert Search & Replace: version: 3.2.1, author: Inpsyde GmbH, Automatische Aktualisierungen deaktiviert WP Broken Link Status Checker: version: 1.0.6, author: Pau Iglesias, SeedPlugins, Automatische Aktualisierungen deaktiviert WP Crontrol: version: 1.10.0, author: John Blackbourn & crontributors, Automatische Aktualisierungen deaktiviert ### wp-media ### image_editor: WP_Image_Editor_Imagick imagick_module_version: 1690 imagemagick_version: ImageMagick 6.9.10-68 Q16 x86_64 2020-04-01 https://imagemagick.org file_uploads: File uploads is turned off post_max_size: 256M upload_max_filesize: 256M max_effective_size: 256 MB max_file_uploads: 20 imagick_limits: imagick::RESOURCETYPE_AREA: 31 GB imagick::RESOURCETYPE_DISK: 9.2233720368548E+18 imagick::RESOURCETYPE_FILE: 768 imagick::RESOURCETYPE_MAP: 31 GB imagick::RESOURCETYPE_MEMORY: 16 GB imagick::RESOURCETYPE_THREAD: 8 gd_version: bundled (2.1.0 compatible) ghostscript_version: 9.25 ### wp-server ### server_architecture: Linux 3.10.0-957.27.2.el7.x86_64 x86_64 httpd_software: Apache php_version: 7.3.27 64bit php_sapi: cgi-fcgi max_input_variables: 1000 time_limit: 600 memory_limit: 1024M max_input_time: 120 upload_max_filesize: 256M php_post_max_size: 256M curl_version: 7.29.0 NSS/3.44 suhosin: false imagick_availability: true pretty_permalinks: true htaccess_extra_rules: true ### wp-database ### extension: mysqli server_version: 5.5.68-MariaDB client_version: mysqlnd 5.0.12-dev - 20150407 - $Id: 7cc7cc96e675f6d72e5cf0f267f48e167c2abb23 $ ### wp-constants ### WP_HOME: undefined WP_SITEURL: undefined WP_CONTENT_DIR: /var/***/httpdocs/wp-content WP_PLUGIN_DIR: /var/***/httpdocs/wp-content/plugins WP_MAX_MEMORY_LIMIT: 1024M WP_DEBUG: false WP_DEBUG_DISPLAY: true WP_DEBUG_LOG: false SCRIPT_DEBUG: false WP_CACHE: true CONCATENATE_SCRIPTS: undefined COMPRESS_SCRIPTS: undefined COMPRESS_CSS: undefined WP_LOCAL_DEV: undefined DB_CHARSET: undefined DB_COLLATE: undefined ### wp-filesystem ### wordpress: writable wp-content: writable uploads: writable plugins: writable themes: writable mu-plugins: writable ### google-site-kit ### version: 1.29.0 php_version: 7.3.27 wp_version: 5.6.2 reference_url: https://www.delamar.de amp_mode: no site_status: connected-site user_status: authenticated connected_user_count: 1 active_modules: site-verification, search-console, analytics, pagespeed-insights required_scopes: openid: ? https://www.googleapis.com/auth/userinfo.profile: ? https://www.googleapis.com/auth/userinfo.email: ? https://www.googleapis.com/auth/siteverification: ? https://www.googleapis.com/auth/webmasters: ? https://www.googleapis.com/auth/analytics.readonly: ? capabilities: googlesitekit_authenticate: ? googlesitekit_setup: ? googlesitekit_view_posts_insights: ? googlesitekit_view_dashboard: ? googlesitekit_view_module_details: ? googlesitekit_manage_options: ? googlesitekit_publish_posts: ? enabled_features: helpVisibility: ? serviceSetupV2: ? storeErrorNotifications: ? userInput: ? widgets.dashboard: ? widgets.pageDashboard: ? widgets.moduleScreens: ? search_console_property: sc-domain:delamar.de analytics_account_id: analytics_property_id: analytics_profile_id: analytics_use_snippet: yes ### wp_mail_smtp ### version: 2.7.0 license_key_type: lite debug: Keine Debug-Hinweise gefunden. db_tables: wp_wpmailsmtp_tasks_meta
YARPP
[versions] => [yarpp] => 5.10.2 [wp] => 5.6.2 [php] => 7.3.27 [mysql] => 5.5.68 [yarpp] => [settings] => [threshold] => 2 [limit] => 6 [excerpt_length] => 10 [recent] => [rss_limit] => 3 [rss_excerpt_length] => 10 [past_only] => [show_excerpt] => [rss_show_excerpt] => [template] => yarpp-template-footer.php [rss_template] => [show_pass_post] => [cross_relate] => 1 [rss_display] => [rss_excerpt_display] => 1 [promote_yarpp] => [rss_promote_yarpp] => [myisam_override] => [weight] => [title] => 3 [body] => 1 [tax] => [category] => 3 [hersteller] => 1 [ssc__format] => 1 [ssc__themen] => 3 [require_tax] => [auto_display_archive] => [auto_display_post_types] => [cache_engine] => tables [changed_settings] => exclude [cache_status] => 0.9311 [stats] => 0:22|6:4734 [diagnostics] => [myisam_posts] => 1 [fulltext_disabled] => [fulltext_indices] => 1 [hidden_metaboxes] => [post_thumbnails] => 1 [happy] => 1 [using_thumbnails] => [generate_thumbnails] => [stats] => [counts] => [post] => 3443 [page] => 179 [attachment] => 0 [testbericht] => 1291 [terms] => [category] => 54 [post_tag] => 0 [post_format] => 0 [hersteller] => 420 [comments] => [moderated] => 1 [approved] => 17878 [total] => 18056 [posts] => 1782 [users] => 161 [locale] => de-DE [url] => https://www.delamar.de [plugins] => [active] => iwp-client/init.php|addquicktag/addquicktag.php|adminimize/adminimize.php|akismet/akismet.php|bj-lazy-load/bj-lazy-load.php|broken-link-checker/broken-link-checker.php|classic-editor/classic-editor.php|cms-tree-page-view/index.php|codepress-admin-columns/codepress-admin-columns.php|contact-form-7/wp-contact-form-7.php|contextual-related-posts/contextual-related-posts.php|enable-media-replace/enable-media-replace.php|google-site-kit/google-site-kit.php|no-self-ping/no-self-pings.php|nxs-snap-pro-upgrade/nxs-snap-pro-upgrade.php|paid-downloads-pro/paid-downloads-pro.php|redirection/redirection.php|searchwp-boolean/searchwp-boolean.php|searchwp-custom-results-order/searchwp-custom-results-order.php|searchwp-metrics/searchwp-metrics.php|searchwp-stemmer-german/searchwp-stemmer-german.php|searchwp/searchwp.php|sem-author-image/sem-author-image.php|seo-smart-links-business/seo-smart-links-business.php|shortpixel-image-optimiser/wp-shortpixel.php|social-networks-auto-poster-facebook-twitter-g/NextScripts_SNAP.php|ssc__auto_notify/ssc__auto_notify_addon.php|ssc_cpt_taxonomies/ssc_cpt_taxonomies.php|ssc_cpt_testberichte/ssc_cpt_testberichte.php|ssc_dlmr_elementor/ssc_dlmr_elementor.php|user-role-editor/user-role-editor.php|w3-total-cache/w3-total-cache.php|wordfence/wordfence.php|wordpress-seo-premium/wp-seo-premium.php|wordpress-seo/wp-seo.php|wp-insert-content-master/wp-insert-content.php|wp-mail-smtp/wp_mail_smtp.php|wpseo-news/wpseo-news.php|wpseo-video/video-seo.php|yet-another-related-posts-plugin/yarpp.php [sitewide] => [pools] =>
- This reply was modified 3 years, 7 months ago by delamar.
Hi @delamar, thanks for the debug info but I’m afraid I’m still not sure what’s wrong. It looks like things should be fine. But I have a few more follow-up questions that will hopefully help pinpoint the problem.
1. You mentioned earlier that you’re using
yarpp_related()
. Would you please copy-and-paste that bit of template code you’re using? That might give me a clue.
2. I’ve created a tweaked version of YARPP that will add a bit more debug info for cases like this, which will hopefully help. Would you mind trying it? Download it here, then go to your WordPress admin dashboard, go to the plugins page, deactivate the current version of YARPP (5.18.2 currently), on the plugins page click “Add New” then “upload” and choose the ZIP file you just downloaded, and activate it (it will be 5.18.3). It will add an HTML comment onto your site explaining why the custom template isn’t being used.
Are familiar with using your browser’s inspector tool to look at the HTML? If so, use it on the YARPP related content and you should see an HTML comment, like this: https://i.imgur.com/pQcHBpG.png and please share the HTML you see in here.
If you’re not, please just point me to a post on your site (which site is also using the version of YARPP I linked-to above) and I can look at the page’s HTML.Does that make sense?
Hey, Michael.
Thanks so much for your help. It is very appreciated.
1. this is the call
<?php if(function_exists('related_entries')) : ?><div class="row m-b-2"><?php yarpp_related(); ?></div><?php endif; ?>
I also tried the older related_entries() but to no success.
2. The comment says:
Could not load custom template “yarpp_template_simple.php”. Its NOT named properly It does NOT exist. Falling back to default.The template names are:
yarpp-template-footer.php (mine)
yarpp-template-simple.php (yours)Both templates have the same problem and lie in the same folder as style.css – where the backend does indeed find them.
Thanks @delamar.
It appears some other plugin is using the filtersanitize_file_name
and replacing all-
s with_
s. That means YARPP is looking for the fileyarpp_template_simple.php
instead ofyarpp-template-simple.php
Can you do a search in your plugins directory for
add_filter( 'sanitize_file_name'
, oradd_filter('sanitize_file_name'
, oradd_filter( "sanitize_file_name"
oradd_filter("sanitize_file_name
? Eg if you have SSH access you could go to the plugins directory and rungrep -rn "add_filter( 'sanitize_file_name'" --include=*\.php
. If not it will be a matter of trying with each plugin individually.That will help reveal the culprit.
Thank you, Michael.
I searched for “sanitize_file_name” with grep and I found these plugins using it:
* Yoast SEO Premium (also the Yoast video plugin and the free version)
* P3 Profiler (deactivated)
* Contextual Related Posts* Better Search & Replace (deactivated)
better-search-replace/templates/bsr-dashboard.php:55: $bsr_template = str_replace( ‘_’, ‘-‘, sanitize_file_name( $active_tab ) ) . ‘.php’;
But actually I think it may be a function() I have in the functions.php for changing filenames when uploading images:
add_filter(‘sanitize_file_name’, ‘ssc__filename_lowercase’, 10);
So what would be your recommendation?
PS: It is my own function that I have in the functions.php
Any advice on how to solve this?
Aha good sleuthing @delamar!
Can you share the body of the functionscc__filename_lowercase
? I think we just need to make it stop replacing dashes with underscores. Do you need to replace dashes with underscores for some reason?Unfortunately it’s all about making the dashes to underscores…for file upload. We had trouble a few times when images had the same filename as an article (even though the extension was another).
My first thought was to change the priority – but then the function does not do what it should when uploading.
Another easy way would be to check, if it is the YARPP plugin using the sanitize_file_name and return without changing anything. But I am not sure how to check for that in the function.
Something like this:
if ( is_yarpp_asking == true ) return;function ssc__filename_lowercase($filename) { $info = pathinfo( $filename ); $ext = empty( $info['extension'] ) ? '' : '.' . $info['extension']; $name = basename( $filename, $ext); $name = str_replace( '-', '_', $name ); // kein minuszeichen $name = strtolower( $name ); // alles klein schreiben $name = preg_replace('/[^a-zA-Z0-9-_.]/','', $name ); // keine umlaute return $name . $ext; } add_filter('sanitize_file_name', 'ssc__filename_lowercase', 10);
Aha, ok.
Here’s an idea: you could check if the original filename starts withyarpp-
, and if so, leave the dashes alone. Otherwise keep doing what you’re doing.What do you think?
- This reply was modified 3 years, 7 months ago by Michael Nelson.
Great, thank you so much!
That works easily enough for us.
- The topic ‘Custom Template Not Showing since v5.10.2’ is closed to new replies.