This repository was archived by the owner on Jan 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 124
Add portfolio archive template with custom query variation #368
Closed
Closed
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
20b9f70
Update archive
carolinan 7a99bc3
Create archive-writer.php
carolinan 4bb2122
Create archive-portfolio.php
carolinan b0cdb49
show portfolio in 3 columns
carolinan dddd8a9
Try query variation for featured images
carolinan ff4dd3a
Update block-variation.js
carolinan 3b81547
add custom query variation to the archive portfolio pattern
carolinan 7f576d3
Update functions.php
carolinan 165c08a
Update block-variation.js
carolinan 680ba04
Delete archive-writer.php
carolinan 771c838
Merge branch 'trunk' into update/archive
carolinan 6329d51
Delete archive.php
carolinan 90c89f7
revert archive.html changes
carolinan 406172d
Merge branch 'trunk' into update/archive
carolinan a00e8b9
Merge branch 'trunk' into update/archive
carolinan 2da894d
try adding a condition for rest_post_query
carolinan 1c81fbe
Try excluding sticky posts
carolinan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
|
||
const { __ } = wp.i18n; | ||
|
||
wp.blocks.registerBlockVariation( 'core/query', { | ||
name: 'twentytwentyfour/featured-image-query', | ||
title: __( 'Featured Images' ), | ||
description: __( 'List of posts with featured images' ), | ||
attributes: { | ||
namespace: 'twentytwentyfour/featured-image-query', | ||
query: { | ||
perPage: 6, | ||
postType: 'post', | ||
order: 'desc', | ||
orderBy: 'date', | ||
inherit: false, | ||
sticky: 'exclude', | ||
hasFeaturedImage: true, | ||
}, | ||
align: 'full', | ||
}, | ||
allowedControls: [ 'order' ], | ||
innerBlocks: [ | ||
[ | ||
'core/post-template', | ||
{ layout: { | ||
type: 'grid', | ||
columnCount: 3 | ||
} }, | ||
[ | ||
[ | ||
'core/post-featured-image', | ||
{ | ||
aspectRatio: 2/3, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure this is working correctly perhaps it should be |
||
isLink: true, | ||
} | ||
], | ||
], | ||
] | ||
], | ||
isActive: [ 'namespace' ], | ||
} ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
/** | ||
* Title: Portfolio Archive Template | ||
* Slug: twentytwentyfour/archive-portfolio | ||
* Template Types: archive | ||
* Viewport width: 1400 | ||
* Inserter: no | ||
*/ | ||
?> | ||
|
||
<!-- wp:group {"style":{"position":{"type":"sticky","top":"0px"}},"layout":{"type":"default"}} --> | ||
<div class="wp-block-group"> | ||
<!-- wp:template-part {"slug":"header","theme":"twentytwentyfour"} /--> | ||
</div> | ||
<!-- /wp:group --> | ||
|
||
<!-- wp:group {"tagName":"main","style":{"spacing":{"blockGap":"0","margin":{"top":"0"}}},"layout":{"type":"default"}} --> | ||
<main class="wp-block-group" style="margin-top:0"> | ||
<!-- wp:query {"query":{"perPage":6,"pages":0,"offset":"0","postType":"post","order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"","inherit":true},"namespace":"twentytwentyfour/featured-image-query","align":"full","layout":{"type":"default"}} --> | ||
<div class="wp-block-query alignfull"> | ||
<!-- wp:group {"style":{"spacing":{"padding":{"top":"var:preset|spacing|50","bottom":"var:preset|spacing|50","left":"var:preset|spacing|50","right":"var:preset|spacing|50"},"margin":{"top":"0","bottom":"0"}}},"layout":{"type":"default"}} --> | ||
<div class="wp-block-group" style="margin-top:0;margin-bottom:0;padding-top:var(--wp--preset--spacing--50);padding-right:var(--wp--preset--spacing--50);padding-bottom:var(--wp--preset--spacing--50);padding-left:var(--wp--preset--spacing--50)"> | ||
<!-- wp:query-title {"type":"archive","align":"wide","style":{"typography":{"lineHeight":"1"},"spacing":{"margin":{"top":"0"}}},"fontSize":"x-large"} /--> | ||
|
||
<!-- wp:spacer {"height":"var:preset|spacing|50","style":{"spacing":{"margin":{"top":"0","bottom":"0"}}}} --> | ||
<div style="margin-top:0;margin-bottom:0;height:var(--wp--preset--spacing--50)" aria-hidden="true" class="wp-block-spacer"></div> | ||
<!-- /wp:spacer --> | ||
|
||
<!-- wp:post-template {"align":"full","style":{"spacing":{"blockGap":"var:preset|spacing|40"}},"layout":{"type":"grid","columnCount":3}} --> | ||
<!-- wp:post-featured-image {"isLink":true,"aspectRatio":"2/3"} /--> | ||
<!-- wp:spacer {"height":"var:preset|spacing|20","style":{"spacing":{"margin":{"top":"0","bottom":"0"}}}} --> | ||
<div style="margin-top:0;margin-bottom:0;height:var(--wp--preset--spacing--20)" aria-hidden="true" class="wp-block-spacer"></div> | ||
<!-- /wp:spacer --> | ||
<!-- /wp:post-template --> | ||
|
||
<!-- wp:spacer {"height":"var:preset|spacing|50","style":{"spacing":{"margin":{"top":"0","bottom":"0"}}}} --> | ||
<div style="margin-top:0;margin-bottom:0;height:var(--wp--preset--spacing--50)" aria-hidden="true" class="wp-block-spacer"></div> | ||
<!-- /wp:spacer --> | ||
|
||
<!-- wp:query-pagination {"paginationArrow":"arrow","layout":{"type":"flex","justifyContent":"space-between"}} --> | ||
<!-- wp:query-pagination-previous /--> | ||
<!-- wp:query-pagination-next /--> | ||
<!-- /wp:query-pagination --> | ||
|
||
<!-- wp:query-no-results --> | ||
<!-- wp:pattern {"slug":"twentytwentyfour/hidden-no-results-content"} /--> | ||
<!-- /wp:query-no-results --> | ||
</div> | ||
<!-- /wp:group --> | ||
</div> | ||
<!-- /wp:query --> | ||
</main> | ||
<!-- /wp:group --> | ||
|
||
<!-- wp:template-part {"slug":"footer-portfolio","area":"footer","tagName":"footer","theme":"twentytwentyfour"} /--> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ryanwelcher Do you have time look at this query loop variation? I can't get this custom query parameter (hasFeaturedImage) to work.
Yes I read the docs, Justin's article, your plugin code, and watched the hallway hangout video 😆
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure thing! I'll have a look when I am back in the office on Monday