| 开发者 | wpyog |
|---|---|
| 更新时间 | 2026年8月2日 02:23 |
| PHP版本: | 7.0 及以上 |
| WordPress版本: | 7.0 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
[wpyog_news layout="carousel" slides_to_show="3" autoplay="true" autoplay_speed="4000" infinite="true" arrows="true" dots="true" transition="slide"]
[wpyog_news layout="carousel" post_type="post,wpyog_document,wpyog_news" collection="homepage-picks" slides_to_show="3"]
News Ticker
Display scrolling news headlines at the top of any page with the [wpyog_ticker] shortcode. Three animation styles are included:
prefers-reduced-motion.
[wpyog_ticker animation="scroll" label="Breaking News" speed="medium" limit="10"]
[wpyog_ticker animation="flap" show_count="true" show_date="true" label="Top News" label_bg="#1a1a2e"]
Smart Shortcode Generator
Generate custom shortcodes directly from the admin panel without coding. The Shortcode Generator has two tabs — one for News List/Card and one for the News Ticker — with a live preview that updates as you change settings.
[wpyog_news layout="card" columns="3" limit="9"]
External News & Source Attribution
WPYog News supports curated external news workflows with external article URLs, source name display, source website links, favicon/logo support, and proper source attribution. Perfect for curated industry news, cybersecurity updates, compliance news, digital transformation articles, and technology feeds.
[wpyog_news] — Shortcode Attributes
layout — Display style. Options: list or card. Default: list
limit — Number of news items to display. Default: 10
category — Filter by category ID. Use comma-separated IDs for multiple categories. Default: all categories
show_date — Show or hide the publication date. Options: true or false. Default: true
show_excerpt — Show or hide the excerpt. Options: true or false. Default: true
excerpt_length — Excerpt length in words. Default: 20
show_source — Show or hide source attribution. Options: true or false. Default: true
order — Sort direction. Options: DESC (newest first) or ASC (oldest first). Default: DESC
orderby — Sort field. Options: date, title, or rand. Default: date
columns — Grid columns (card layout only). Options: 2, 3, or 4. Default: 3
pagination_type — Pagination style (list layout only). Options: numeric or prev-next. Default: numeric
extra_class — Add a custom CSS class to the wrapper. Default: none
post_type — Mix WPYog News with other post types in the same layout. Comma-separated CPT slugs, e.g. post_type="wpyog_news,post,product". Only shared fields (title, excerpt, featured image, date) are used for mixed items — anything WPYog-News-specific (External URL, Source Details) is simply skipped for items that don't have it. Default: wpyog_news
taxonomy — Taxonomy the category attribute filters against. Default: wpyog_news_cat. Only change this if the other post types you're mixing in share a different taxonomy (e.g. category) — WPYog News's own category taxonomy only applies to wpyog_news items.
show_type — Show a small badge with each item's post type label (e.g. "News", "Post") — handy for telling sources apart when mixing post types. Options: true or false. Default: false
ids — Hand-pick exact posts to display, across any mix of post types — no shared category needed. Comma-separated post IDs, e.g. ids="12,45,78". Overrides limit, category, and pagination; posts appear in the order listed unless orderby is set to something else. Find a post's ID from the URL when editing it (post.php?post=123).
collection — Show a repeatable curated group of posts spanning any mix of post types, without editing the shortcode as the group grows. Tick the checkbox for a "Collection" on any post from its normal edit screen (or click "+ Add New Collection" to create one — no shortcode needed), then pull them all in with collection="homepage-picks" (comma-separated slugs for more than one). Combines with category (both must match) but is ignored when ids is set.
[wpyog_ticker] — Shortcode Attributes
animation — Animation style. Options: scroll, fade, or flap. Default: scroll
speed — Animation speed. Options: slow, medium, fast, or any integer (px/s). Default: medium
limit — Number of news items to show. Default: 10
category — Filter by category ID, comma-separated. Default: all categories
order — Sort direction: DESC or ASC. Default: DESC
orderby — Sort field: date, title, or rand. Default: date
show_label — Show or hide the label chip. Options: true or false. Default: true
label — Label text. Default: Breaking News
label_bg — Label background colour (hex). Default: #e74c3c
label_color — Label text colour (hex). Default: #ffffff
show_date — Show publication date next to each headline. Options: true or false. Default: true
show_count — Show a post counter (e.g. 2 / 10). Options: true or false. Applies to fade and flap only. Default: false
pause_on_hover — Pause ticker on mouse hover. Options: true or false. Default: true
direction — Scroll direction (scroll mode only). Options: left or right. Default: left
separator — Character between items (scroll mode only). Default: •
extra_class — Add a custom CSS class to the wrapper. Default: none
Also registered as [wpyog_news_ticker] — both shortcode names work identically.
Use Cases
wpyog-news folder to /wp-content/plugins/.Yes. The plugin includes a List layout, a Card layout, and a News Ticker.
The News Ticker displays animated news headlines in a bar that you can place anywhere on your site using the [wpyog_ticker] shortcode. Three animation styles are available: scroll (continuous horizontal), fade (cross-fade), and flap (push-up slide). Use WPYog News → Shortcode Generator → News Ticker tab to configure it.
Yes. WPYog News supports external article URLs and source attribution.
Yes. You can display the source name, source URL, and source favicon/logo for curated news articles.
Yes. WPYog News includes a built-in shortcode generator with two tabs — one for News List/Card and one for the News Ticker — with a live preview.
Yes. News posts can be grouped and filtered using categories. Use the category attribute with the category ID: [wpyog_news category="5"]. Category IDs are shown in WPYog News → Categories.
Yes. Add the post_type attribute with a comma-separated list of post type slugs, e.g. [wpyog_news post_type="wpyog_news,post,product" layout="carousel"]. Only the fields shared across all post types — title, excerpt, featured image, and date — are shown. External URL and Source Details still display for wpyog_news items but are simply skipped for other post types. The Shortcode Generator and Gutenberg block both include a Post Types checklist for this.
Two ways, depending on whether the selection is a one-off or something you'll keep adding to:
For a one-off selection, use the ids attribute. It takes a comma-separated list of post IDs and works across any mix of post types since it doesn't rely on a shared taxonomy: [wpyog_news post_type="wpyog_news,post,product" ids="12,45,78"]. Posts show in the exact order you list the IDs. Find a post's ID from its edit-screen URL (post.php?post=123).
For a selection you'll keep adding to over time, use a Collection instead — it's repeatable, so you never have to edit the shortcode again. Open any post (News, a Blog Post, a Product, any post type) and in its Collections box, tick the checkbox for the collection you want (or click "+ Add New Collection" to create one, e.g. "Homepage Picks"). Tick the same collection on posts from other post types too, then show them all with [wpyog_news post_type="wpyog_news,post,product" collection="homepage-picks"]. New posts checked into the collection later appear automatically — no shortcode edits.
Both the Shortcode Generator and the Gutenberg block have fields for ids and collection.
Yes. All layouts are optimized for desktop, tablet, and mobile devices. The News Ticker automatically adjusts its label and font size on small screens.
Yes. WPYog News includes full Elementor Theme Builder support — News posts appear as conditions in the Theme Builder so you can build custom single post templates. A native Gutenberg block is also included.
No. The plugin is designed for easy management directly from the WordPress dashboard.
When editing a news item, add a URL in the External Link field. The news title and Read More button will then link to that external URL (opens in a new tab) instead of the internal news page. External links also work in the News Ticker.
The card layout uses a Load More button via AJAX instead of traditional pagination.
Yes. Add show_count="true" to [wpyog_ticker] to display a "3 / 10" badge on the right side of the ticker. This works with fade and flap animation modes.
wpyog_collection taxonomy shared across every public post type, used to build a repeatable curated group of posts spanning any mix of post types. Tag posts from their normal edit screen (like adding a tag) and pull them all into a layout with the new collection attribute — no editing the shortcode as the collection grows.ids attribute — hand-pick exact posts to display, across any mix of post types, without needing a shared category/taxonomy. Comma-separated post IDs, e.g. ids="12,45,78"; overrides limit, category, and pagination, and preserves the listed order. Available in the shortcode, the Shortcode Generator (Specific Post IDs field), and the Gutenberg block (Advanced panel).[wpyog_news] layout via the new post_type attribute (comma-separated CPT slugs) — e.g. combine WPYog News with Posts, WooCommerce Products, or any custom post type in the same List, Card, or Carousel display. Only shared fields (title, excerpt, featured image, date) are used for mixed items; WPYog-News-specific fields (External URL, Source Details) are skipped gracefully for other post types.taxonomy attribute — lets the category filter target a different taxonomy when mixing post types that share one (e.g. category).show_type attribute — shows a small badge with each item's post type label, useful for telling sources apart in a mixed feed.gap was greater than 0 (confirmed via live testing — cutting disappeared at gap="0"). Real root cause: carousel items use flex-shrink: 0 (they're meant to stay a fixed size), so they never shrink to make room for the track's gap — a plain percentage flex-basis (e.g. 3 items at 33.3333%) already fills the row, and the gap on top of that always overflows by exactly (number of gaps × gap width), which is what was being clipped. Fixed by computing each slide's width with calc((100% - (n-1) × gap) / n) instead of a flat percentage, so the gap is subtracted before dividing. Gap now works at any value without cutting off the last slide.20px 6px) added horizontal margin on top of flex-basis percentages that already summed to 100% of the row — the extra margin pushed the row wider than the viewport, and the viewport's overflow:hidden sliced off the overflow. Fixed by making the card margin vertical-only (20px 0); horizontal spacing between slides is handled by the track's gap instead, which browsers correctly account for when sizing flex-basis so it can't overflow.min-width: 0), and long titles/excerpts wrap instead of forcing overflow.arrows_on_hover carousel attribute — arrows stay hidden until the carousel is hovered (desktop only; always visible on touch devices).20px 6px margin for breathing room between and around slides..wpyog-card-no-thumb height now matches the real thumbnail height (210px, was 160px), so cards with and without a featured image line up evenly — affects Card grid and Carousel.[wpyog_news] — layout="carousel". A sliding row of news cards with autoplay, prev/next arrows, dot navigation, infinite loop, slide or fade transition, touch swipe support, and responsive slides-to-show.slides_to_show, autoplay, autoplay_speed, infinite, arrows, dots, pause_on_hover, transition, gap.prefers-reduced-motion.flap animation mode — current headline slides out upward while the next headline slides in from below, clipped cleanly by the ticker viewport. Works consistently across all browsers..wpyog-card-cats a category pill padding updated.show_label attribute — set show_label="false" to hide the label chip entirely.show_count attribute — set show_count="true" to display a post counter (e.g. 3 / 10) on the right side of the ticker. Applies to fade and flap animation modes.[wpyog_news_ticker] shortcode alias — both [wpyog_ticker] and [wpyog_news_ticker] work identically.show_date now defaults to true.[wpyog_ticker] to display animated news headlines anywhere on your site. Three animation styles: scroll (continuous horizontal ticker tape), fade (cross-fade), and flap (animated slide).prefers-reduced-motion accessibility support — ticker pauses automatically for users who prefer reduced motion.single_template filter is removed, allowing Elementor Pro's template_include hook to take over cleanly.wp_unslash() calls.