gchtr
Forum Replies Created
-
Forum: Plugins
In reply to: [Timber] Warning ErrorAnd what does your PHP template file that renders this Twig template look like?
Forum: Plugins
In reply to: [Timber] Warning ErrorWhat does your Timber template look like that renders the output for this page?
Forum: Plugins
In reply to: [Yoast SEO] Yoast Meta descriptions not saving@mazedulislamkhan Yeah, I meant to say that the issue might not be with Yoast, but with the Intuitive Custom Post Order plugin. I could solve the issue by not using another plugin for now. I put my answer here in case someone uses that plugin too and runs into the same error.
Forum: Plugins
In reply to: [Yoast SEO] Yoast Meta descriptions not savingWe have the same issue when we use the Intuitive Custom Post Order plugin. There’s already an open issue about that.
Forum: Plugins
In reply to: [Timber] Timber: category archive page not sorting or displaying all postsYep, you’re right, your
$args
won’t have any effect, because in your Twig file, you’re accessing your posts throughcurrent_cat.posts
, which uses a default query to access all posts in a category. To make it work like want it to be, you could change your PHP file to the following:$args = array( 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'cat' => ( get_queried_object() )->term_id ); $context = Timber::get_context(); $context['posts'] = Timber::get_posts($args); $templates = array( 'category.twig', 'archive.twig', 'index.twig' ); Timber::render( $templates, $context );
The trick is to adapt the query to select posts from a certain category with the additional
cat
parameter instead of selecting posts on a category in Twig. Check out the documentation about WP_Query if you’re looking for more parameters, or if you’re using custom taxonomies.In your Twig file, you would then write:
<ul> {% for post in posts %} <li>{{ post.title }}</li> {% endfor %} </ul>
Forum: Plugins
In reply to: [Timber] Blank 404 error pageHey there
Usually, you don’t need routes to display 404 pages. It’s enough if you provide a 404.php file in the root folder of your theme. So if you have the 404.php file in a subfolder called “routes”, it won’t work. Try moving the 404.php into the root of your theme and delete the routes in your functions.php. I’d say it should work then.
Otherwise, you can check out how it’s done in the Starter Theme.
Forum: Plugins
In reply to: [Timber] Warning: call_user_func_array()Hey @mjbiller
I assume that somewhere in your Twig views, you have a call like the following:
{{ wp_header() }}
or maybe even
{{ function('wp_header') }}
That call should probably be replaced with
{{ function('wp_head') }}
If that doesn’t help, search for
wp_header
in your Twig views to find where it’s used and post that code section here so we can see what’s going on.Also, you might want to use
define( 'WP_DEBUG', false );
in your wp-config.php, so that the error doesn’t show up. Ideally, you’d have a second setup of the site to test updates and fix errors.
Forum: Plugins
In reply to: [Timber] Shortcode execution in post excerptWould you mind creating an issue for this on Github (https://github.com/timber/timber/issues)? It’s easier for us to track issues there.
Forum: Plugins
In reply to: [Timber] ACF & GutenbergThere’s a similar issue on Github: https://github.com/timber/timber/issues/1645, but I’d say there’s no plan yet. And probably we can’t say more until a more definite version of Gutenberg comes out.
Forum: Plugins
In reply to: [MultilingualPress] What does the button ?Translate this post? do?Thanks for your clarification!
Translate this post checkbox connects the post to the remote site, so if you check it and you Publish/Update the post, you’ll find a new post created in the remote site with Draft status.
Cool, so that’s how it should work. Apparently, it didn’t work me, because it always bailed out on the following line: https://github.com/inpsyde/MultilingualPress/blob/2.11/src/inc/post-translator/Mlp_Translatable_Post_Data.php#L457.
Now that got me thinking, there must another plugin that is using
switch_to_blog
. And yes, Intuitive Custom Post Order seems to be the culprit, because it doesn’t userestore_current_blog()
after usingswitch_to_blog()
. The issue needs to be resolved by the plugin author.- This reply was modified 7 years, 4 months ago by gchtr. Reason: Update info about solution
Forum: Reviews
In reply to: [Timber] Deprecated Elements constantly throwing errorsYeah, it could be a little confusing first. When you use
{{ function('function_you_want_to_call') }}
, you can put this directly into your Twig file.I guess somewhere in a Twig file in your theme you do something like this:
{{ ninja_forms_display_form(4) }}
You can replace this with:
{{ function('ninja_forms_display_form', 4) }}
The first argument of
function()
is always the name of the function to call, followed by all the arguments you need to pass. In this example, you’d have to replace the4
with whatever argument you used before.You can then delete
$context['ninja_forms_display_form'] = TimberHelper::function_wrapper( 'ninja_forms_display_form' );
from your PHP file. You don’t need it anymore.
I hope this clears things up.
- This reply was modified 7 years, 7 months ago by gchtr.
Forum: Reviews
In reply to: [Timber] Deprecated Elements constantly throwing errorsHey @msarns
The
function_wrapper
function is not a feature of Twig itself, but rather an extension of Timber. That’s why you didn’t find anything about it in the Twig Documentation.It was used to make PHP functions available when working in Twig files and was deprecated, because it was necessary only in earlier versions of Timber. Now, there are other ways to call PHP functions from Twig or make functions available to Twig. You can find a documentation for this in the Functions Guide of the Timber Documentation.
To make the warnings go away, you will have to replace every occurrence of
function_wrapper
in your theme by either using{{ function('function_you_want_to_call') }}
directly in your Twig file or using thetimber/twig
filter to add a new function to the Twig Environment.Forum: Plugins
In reply to: [Loco Translate] Loco doesn’t respect user language in backendAlright, now I get it (
loco-translate
= Legacy 1.x,loco
= Version 2).I’ll translate it myself, then. Thanks a lot for the quick support!
Forum: Plugins
In reply to: [Loco Translate] Loco doesn’t respect user language in backendThanks a lot for the elaboration!
So until version 2.1 arrives I guess I’ll rename the translation files to match the
loco
text domain.Forum: Plugins
In reply to: [SVG Support] WP 4.7.1 Kills SVGUse the following plugin to fix this issue until it is resolved in WordPress Core: