Uncaught Twig_Error_Syntax: Unexpected token "operator" of value ">" - wordpress

Im developing my wordpress theme in a docker environment using timber / twig for my templating.
When i hosted my theme on a testwebsite i got the following 'fatal error'!
<b>Fatal error</b>: Uncaught Twig_Error_Syntax: Unexpected token "operator" of value ">". in blabla/templates/single.twig:32
Talking about the following code:
<p>
<strong>Tags:</strong> {{ post.tags|map(t => t.name)|join(', ') }}
</p>
I know I can rewrite the code and it will work without using the |map filter but thats not the point here ;-)

Stuck with the same problem. Somehow WP does not show me that update for timber plugin is available. Seems like timber team reverted plugin version and i didn't get the update(some problems with WPML compatibility).
Manually uploaded plugin v 1.9.5 (minimum required to understand arrow functions)

So this is what i found out..
By using the Timber plugin i have no saying in what twig version i get. So i deactivated my current timber plugin, downloaded it again and checked what i got..
Turned out it included an older version on twig. :(
Updated the twig version in my local env. Uploaded that. And now it works :(

Timber in WP repo has older version of Twig and always will. If you want to have the lates you should use Composer.
https://timber.github.io/docs/v2/installation/
Btw if you want to know Twig version try this
{{ constant('Twig_Environment::VERSION') }}

Related

Drupal 9: dd(), ddm() or drupal_dump() missing

I've installed D9 plus devel and created a custom theme (with all the necessary files, works nicely) and enabled all the necessary dev-centric settings, but it seems that the necessary functions like dd() or drupal_dump() are not found. I've already checked that everything related to the devel module (devel, devel generate, devel web profiler) is enabled in my Drupal.
Any help appreciated!
drupal_dump(), alias dd(), is not provided by devel, but by another module named twig_tweak. It requires Symfony's VarDumper component to work. You can install them using composer :
composer require --dev symfony/var-dumper
composer require drupal/twig_tweak
drush en twig_tweak
ddm() doesn't print anything to the screen but outputs a variable to a file named drupal_debug.txt in the site's temp directory.
More on devel functions here.
Long story
In drupal 7.x and up to version 8.6.0, dd() was indeed provided by the devel module, but it was an alias for drupal_debug() (d7) and DevelDumperManager::debug() (d8), but it has been deprecated and replaced by ddm() since 8.6.0, because Symfony's VarDumper component already has a function named dd().
Now to add further confusion, twig_tweak is using the alias dd() for drupal_dump() (source).
Even if both functions end up calling Symfony's VarDumper::dump(), Symfony's dd means "dump and die" and is meant to immediately ends the execution of the script after dumping the variables, whereas twig_tweak's drupal_dump/dd does not.
The exact same thing happens in Laravel : it uses Symfony's VarDumper and overrides its dd function with a function that doesn't behave the same, instead of using a different name.

Hugo warnings for R blogdown with hugo (academic theme): Do I need to do anything?

I've started getting warnings everytime I do a build in blogdown
In RStudio, I run the code:
blogdown::serve_site()
The site is rendered fine, but I get the following warnings.
Building sites … WARN 2020/02/19 17:13:53 Page.Hugo is deprecated and will be removed in a future release. Use the global hugo function.
WARN 2020/02/19 17:13:53 Page.RSSLink is deprecated and will be removed in a future release. Use the Output Format's link, e.g. something like:
{{ with .OutputFormats.Get "RSS" }}{{ .RelPermalink }}{{ end }}
WARN 2020/02/19 17:13:53 .File.TranslationBaseName on zero object. Wrap it in if or with: {{ with .File }}{{ .TranslationBaseName }}{{ end }}
WARN 2020/02/19 17:13:53 Page.Dir is deprecated and will be removed in a future release. Use .File.Dir
WARN 2020/02/19 17:13:53 Page.UniqueID is deprecated and will be removed in a future release. Use .File.UniqueID
WARN 2020/02/19 17:13:54 Page.URL is deprecated and will be removed in a future release. Use .Permalink or .RelPermalink. If what you want is the front matter URL value, use .Params.url
I'm just wondering, do I need to do anything, or will these issues be addressed by:
blogdown package in R? or
hugo academic them? or
both? or
someone/thing else???
Thank you! :)
The purpose of the warning messages is to inform you that your site is using functions or referencing variables that are or will be deprecated and removed from future releases of Hugo. If they are not changed before they are removed from Hugo, your website might not build.
Now, to answer your question: Unless you have manually edited your layout files or made changes to the Academic theme, these warnings will (should) be addressed by the developers of Academic. What you need to do, is make sure to update the theme when new releases are available.

ReactJS / WP Picard theme error

Hi I am currently learning and experimenting with the ReactJS / WP theme by Jack Lenox https://github.com/Automattic/Picard I when I have installed it is not displaying the posts & the Console is displaying this message Uncaught TypeError: Cannot read property 'hasClass' of null
Anyone help? Thanks heaps :)
I solved 'Fatal error: Class 'WP_JSON_Comments' not found in .../functions.php line 163' this error by downloading wp-rest plugin from wordpress plugin center, current Version is 1.2.4.https://wordpress.org/plugins/json-rest-api/
Current picard is using wp-rest V1, wp-rest v2 still in beta. refer to: https://github.com/Automattic/Picard/issues/43
Also I updated my wordpress to 4.4.1

Updating Theme Framework Getting privileges Error

I have just Install New woocommerce theme Mystile Version 1.2.9. while using it i am getting error like:
"Warning: Invalid argument supplied for foreach() in D:\wamp\www\tramawoo\wp-content\themes\mystile\functions\admin-functions.php on line 3193"
On some forum i read that i have to upgrade Mystile Theme Framework to "WooFramework update is available (v5.5.5)". to get rid from this error.
So from Dashboard >> Mystile Theme > Theme Options >> when i click on WooFramework update is available (v5.5.5) i get this message.
"You do not have sufficient permissions to access this page."
I am logged in as ADMIN and also i am on my local-server WAMP.
Please suggest.
Thanks
This could be a bug in the theme or in the framework. It's hard to diagnose from afar. I would suggest that you manually download the new version and just replace it manually.

Error While Activating A New WordPress Plugin

I m learning to develop plugin and I am getting error on activation saying
The plugin generated 157 characters of unexpected output during
activation. If you notice “headers already sent” messages, problems
with syndication feeds or other issues, try deactivating or removing
this plugin.
I tried removing and making a new one but same error. here is my code (basic PHP comment to start a plugin, nothing fancy).
/*
Plugin Name: Awesomeness
Plugin URI: http://www.example.com/
Author URI: http://www.example.com/
Author: abc
Description: Just a fun plugin
*/
function fubs(){
error.log("this is working");
}
register_activation_hook(__FILE__,'fubs');
There is no white space before or ending on PHP code.
error is an undefined constant in your PHP code. You try to mix JavaScript with PHP, so PHP prints an error message.
Solution: Use PHP code in PHP and JavaScript code in JavaScript.

Resources