Описание
Easily display posts, pages, or custom post types in content areas using a customizable shortcode. Display your latest posts, group by taxonomies, or use custom templates with Timber for Twig support.
Shortcode Options and Examples
Display a specific post type:
[ac_custom_loop type=»foo»]
This displays posts from the foo
custom post type.
Display posts with specific tags:
[ac_custom_loop type=»post» tax=»tag» term=»foo»]
This displays posts tagged with foo
.
Group posts by taxonomy (e.g., categories and tags):
[ac_custom_loop type=»post» subtax=»category,tag»]
Groups posts by categories, then by tags within each category.
Exclude posts by specific tags:
[ac_custom_loop type=»post» tax=»tag» term=»foo,bar» exclude=»baz»]
This displays posts tagged with foo
and bar
, but excludes those tagged with baz
.
Use a custom template for loop display:
To use a custom template, copy loop-template.php
from the plugin folder to the root of your theme folder and modify as desired. You can also create templates for specific post types (e.g., loop-template-post.php
).
Установка
- Install via WordPress Add New Plugin feature by searching «AC Custom Loop,» or upload the plugin files to
/wp-content/plugins/ac-wp-custom-loop
. - Activate the plugin via the ‘Plugins’ screen in WordPress.
- Use
[ac_custom_loop]
shortcode in any page, post, or widget supporting shortcodes. - The default setup displays your latest 4 posts. Customize with attributes like
type
andshow
, e.g.,[ac_custom_loop type="page" show="3"]
to display the latest three pages.
Часто задаваемые вопросы
-
How do I show posts from a specific post type?
-
Use
[ac_custom_loop type="your_post_type"]
to show posts from a specific custom post type. -
Can I display posts with a specific taxonomy term?
-
Yes! Use
[ac_custom_loop type="post" tax="tag" term="your_term"]
to filter posts by taxonomy term. -
How can I group posts by taxonomies?
-
Use
[ac_custom_loop subtax="category,tag"]
to group posts by taxonomies. -
Can I exclude specific terms?
-
Yes, add
exclude="term"
to exclude posts tagged with that term. -
Can I use custom templates?
-
Absolutely! Copy
loop-template.php
to your theme directory or create post-type-specific templates, such asloop-template-post.php
.
Отзывы
Нет отзывов об этом плагине.
Участники и разработчики
«AC Custom Loop Shortcode» — проект с открытым исходным кодом. В развитие плагина внесли свой вклад следующие участники:
УчастникиПеревести «AC Custom Loop Shortcode» на ваш язык.
Заинтересованы в разработке?
Посмотрите код, проверьте SVN репозиторий, или подпишитесь на журнал разработки по RSS.
Журнал изменений
1.5.1 (2024-11-01)
- Added support for grouping posts by multiple taxonomies.
- Refactored core code for improved maintainability.
1.5 (2021-04-04)
- Enhanced Timber compatibility.
1.4.3 (2019-12-06)
- Resolved release issues.
1.4.2 (2019-12-24)
- Fixed shortcode argument issues.
1.4.0 (2019-12-05)
- Added support for specific post type templates and custom Timber integration.
1.1.0 (2018-10-16)
- Added default post order and optional excerpt in the default template.
0.1.0 (2018-10-07)
- Initial release.