Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with @published and @modified when trying format the date for a given post #57

Closed
gmutschler opened this issue Mar 9, 2021 · 1 comment · Fixed by #88
Closed

Comments

@gmutschler
Copy link

When trying to format a date for a specific post (so outside the loop) with say @published('c', $my_post_id), I got the following error :

ErrorException thrown with message "is_int() expects exactly 1 argument, 2 given (View: /<path-to-bedrock-project>/web/app/themes/<sage-theme-name>/resources/views/<partial-or-component-name>.blade.php) (View: /<path-to-bedrock-project>/web/app/themes/<sage-theme-name>/resources/views/<partial-or-component-name>.blade.php)"

Stacktrace:
#26 ErrorException in /<path-to-bedrock-project>/web/app/themes/<sage-theme-name>/storage/framework/views/5c73c21d2feb906cdb575e6a6a17a888e1f9d60c.php:18
#25 Illuminate\View\Engines\CompilerEngine:handleViewException in /<path-to-bedrock-project>/web/app/themes/<sage-theme-name>/vendor/illuminate/view/Engines/PhpEngine.php:60
#24 ErrorException in /<path-to-bedrock-project>/web/app/themes/<sage-theme-name>/storage/framework/views/5c73c21d2feb906cdb575e6a6a17a888e1f9d60c.php:18
#23 Illuminate\View\Engines\CompilerEngine:handleViewException in /<path-to-bedrock-project>/web/app/themes/<sage-theme-name>/vendor/illuminate/view/Engines/PhpEngine.php:60
#22 ArgumentCountError in /<path-to-bedrock-project>/web/app/themes/<sage-theme-name>/storage/framework/views/5c73c21d2feb906cdb575e6a6a17a888e1f9d60c.php:18
#21 is_int in /<path-to-bedrock-project>/web/app/themes/<sage-theme-name>/storage/framework/views/5c73c21d2feb906cdb575e6a6a17a888e1f9d60c.php:18
#20 require in /<path-to-bedrock-project>/web/app/themes/<sage-theme-name>/vendor/illuminate/filesystem/Filesystem.php:107
#19 Illuminate\Filesystem\Filesystem:Illuminate\Filesystem\{closure} in /<path-to-bedrock-project>/web/app/themes/<sage-theme-name>/vendor/illuminate/filesystem/Filesystem.php:108
#18 Illuminate\Filesystem\Filesystem:getRequire in /<path-to-bedrock-project>/web/app/themes/<sage-theme-name>/vendor/illuminate/view/Engines/PhpEngine.php:58
#17 Illuminate\View\Engines\PhpEngine:evaluatePath in /<path-to-bedrock-project>/web/app/themes/<sage-theme-name>/vendor/illuminate/view/Engines/CompilerEngine.php:61
#16 Illuminate\View\Engines\CompilerEngine:get in /<path-to-bedrock-project>/web/app/themes/<sage-theme-name>/vendor/illuminate/view/View.php:139
#15 Illuminate\View\View:getContents in /<path-to-bedrock-project>/web/app/themes/<sage-theme-name>/vendor/illuminate/view/View.php:122
#14 Illuminate\View\View:renderContents in /<path-to-bedrock-project>/web/app/themes/<sage-theme-name>/vendor/illuminate/view/View.php:91
#13 Illuminate\View\View:render in /<path-to-bedrock-project>/web/app/themes/<sage-theme-name>/vendor/illuminate/view/Concerns/ManagesComponents.php:92
#12 Illuminate\View\Factory:renderComponent in /<path-to-bedrock-project>/web/app/themes/<sage-theme-name>/storage/framework/views/d401be0f5ff0cd450673ff34520d64b8693aac18.php:36
#11 require in /<path-to-bedrock-project>/web/app/themes/<sage-theme-name>/vendor/illuminate/filesystem/Filesystem.php:107
#10 Illuminate\Filesystem\Filesystem:Illuminate\Filesystem\{closure} in /<path-to-bedrock-project>/web/app/themes/<sage-theme-name>/vendor/illuminate/filesystem/Filesystem.php:108
#9 Illuminate\Filesystem\Filesystem:getRequire in /<path-to-bedrock-project>/web/app/themes/<sage-theme-name>/vendor/illuminate/view/Engines/PhpEngine.php:58
#8 Illuminate\View\Engines\PhpEngine:evaluatePath in /<path-to-bedrock-project>/web/app/themes/<sage-theme-name>/vendor/illuminate/view/Engines/CompilerEngine.php:61
#7 Illuminate\View\Engines\CompilerEngine:get in /<path-to-bedrock-project>/web/app/themes/<sage-theme-name>/vendor/illuminate/view/View.php:139
#6 Illuminate\View\View:getContents in /<path-to-bedrock-project>/web/app/themes/<sage-theme-name>/vendor/illuminate/view/View.php:122
#5 Illuminate\View\View:renderContents in /<path-to-bedrock-project>/web/app/themes/<sage-theme-name>/vendor/illuminate/view/View.php:91
#4 Illuminate\View\View:render in /<path-to-bedrock-project>/web/app/themes/<sage-theme-name>/index.php:15
#3 include in /<path-to-bedrock-project>/web/wp/wp-includes/template-loader.php:106
#2 require_once in /<path-to-bedrock-project>/web/wp/wp-blog-header.php:19
#1 require in /<path-to-bedrock-project>/web/index.php:6
#0 require in /<path-to-home>/.composer/vendor/laravel/valet/server.php:214

Same with @modified directive, but it seems to work in cases, I don't need to provide an ID (eg: @published('c')).

@lgt
Copy link

lgt commented May 11, 2022

Hi,

I have the same issue with published.
If I pass a second parameter to target a given post then the error will occur.
Would be possible just to remove the or is_int() comparsion hier https://github.com/Log1x/sage-directives/blob/master/src/Directives/WordPress.php#L228.

If I do it, works as expected!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants