标签: custom-wordpress-pages

如何将静态页面添加到WordPress?

只是想知道如何将我自己的静态html页面添加到WordPress?例如,假设我有一个页面products.html,如何将其添加到wordpress(任何菜单等),一旦添加,我如何访问它们因为wordpress具有典型的url结构.

php wordpress custom-wordpress-pages

26
推荐指数
4
解决办法
6万
查看次数

Visual Composer 自定义短代码模板 - custom_markup 显示用户输入

我创建了一些短代码元素。现在我想在后端编辑器中自定义元素的外观。

从VC-Pagebuilder wiki的描述中,我发现我可以为此使用“custom_markup”参数。

对于简单的 html,它工作正常。但是我无法在简码后端元素中显示用户输入。

<?php
    add_shortcode('simpletext', 'simpletext_shortcode');
    add_action('vc_before_init', 'simpletext_vc');

    // Frontend output

    function simpletext_shortcode($atts, $content = '') {
      ob_start();
      set_query_var('content', $content);
      get_template_part('components/content', 'simpletext');
      return ob_get_clean();
    }

    // Backend
    function simpletext_vc() {
      vc_map(array(
        "name" => "Einfacher Text",
        "base" => "simpletext",
        "class" => "",
        "icon" => get_template_directory_uri() ."/images/vc_icons/simpletext_icon.png", 
    "custom_markup" => '{{ content }}', // try to display the user input
    "category" => "Text",
    "params" => array(
      array(
        "param_name" => "content",
        "heading" => "Inhalt",
        "description" => "Inhalt des Elements.",
        "holder" …
Run Code Online (Sandbox Code Playgroud)

php wordpress wordpress-theming custom-wordpress-pages shortcode

13
推荐指数
1
解决办法
1111
查看次数

如何在Wordpress中创建自定义页面?

如何在Wordpress 3.0中创建自定义页面.给我任何教程链接.

php wordpress custom-wordpress-pages

12
推荐指数
2
解决办法
3万
查看次数

如何修复 Hugo CMS 中“页面”的“HTML”没有布局文件的错误?

我最近将我的 WordPress 页面中的内容导入 Hugo。当我运行时,hugo serve我收到以下错误消息:

WARN 2020/02/17 20:51:06 found no layout file for "HTML" for "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
Run Code Online (Sandbox Code Playgroud)

有问题的页面是这样开始的:

---
linktitle: "The Title of the Post"
title: "The Title of the Post"
author: "Franz Drollig"
type: post
date: 2020-01-09T14:41:55+00:00
url: /the-title-of-post/
categories:
  - Uncategorized
weight: 10

---


This is the content of the post. This is the second sentence of the post. 
Run Code Online (Sandbox Code Playgroud)

它位于mysite/content/posts/YYYY-MM-DD-title.md. …

wordpress export github custom-wordpress-pages hugo

9
推荐指数
4
解决办法
5046
查看次数

Wordpress cron wp_schedule_single_event – 动作并不总是有效

我正在注册一个事件,如:

wp_schedule_single_event( time(), 'do_custom_hook', array( $body ) );
Run Code Online (Sandbox Code Playgroud)

在此之上,我添加了以下操作:

add_action('do_custom_hook', 'process_custom_hook', 10);

function process_custom_hook($body){
    // custom code here
}
Run Code Online (Sandbox Code Playgroud)

但是,有时 process_custom_hook 函数会触发,而其他时候,它根本不会触发(不过,它大多数时候都会触发。大约 10%-20% 的时间会被忽略)

该事件始终返回 true,这意味着它必须已注册。

此外,在测试时,我确保参数(主体)总是不同的。

这可能发生的任何原因?

php wordpress cron custom-wordpress-pages woocommerce

9
推荐指数
1
解决办法
1712
查看次数

在树枝/木材主题中设置自定义占位符图像

所以我遇到了一个twig/timber问题,我很难获得地点图像集,这是我到目前为止所遇到的问题:

{% set defaultimg = site.theme.link ~ '/images/placeimage.png' %}
Run Code Online (Sandbox Code Playgroud)

然后在我的代码中我有:

<img src="{{ post.thumbnail.src | default(defaultimg) | resize(360, 240)}}" class="card-img-top">
Run Code Online (Sandbox Code Playgroud)

post.thumbnail.src 可以很好地提取图像,但如果帖子中没有附加特色 Img,我希望defaultimg从我的自定义主题图像文件夹中提取图像。但目前这输出了一个非常错误的网址:

<img src="https://toolcart.local/wp-contentC:\Users\User\Local Sites\toolcart\app\public\wp-content\themes\toolcart-theme\images/placeimage-360x240-c-default.png" class="card-img-top">
Run Code Online (Sandbox Code Playgroud)

但是 a{{defaultimg}}正确输出图像 url。

https://toolcart.local/wp-content/themes/toolcart-theme/images/placeimage.png
Run Code Online (Sandbox Code Playgroud)

我不确定接下来要尝试什么?

php wordpress custom-wordpress-pages twig timber

8
推荐指数
1
解决办法
922
查看次数

如何以编程方式更改 WordPress 的默认帖子永久链接?

在 WordPress 的后端,我使用默认http://localhost/sitename/example-post/值来创建永久链接。

对于自定义帖子类型,我以这种方式定义了自定义 slug,例如services

register_post_type( 'service',
    array(
        'labels'      => array(
            'name'          => __( 'Services' ),
            'singular_name' => __( 'Service' )
        ),
        'public'      => true,
        'has_archive' => true,
        'rewrite'     => array(
            'slug'       => 'services',
            'with_front' => true
        ),
        'supports'    => array(
            'title',
            'editor',
            'excerpt',
            'thumbnail'
        ),
        'taxonomies'  => array( 'category' ),
    )
);
Run Code Online (Sandbox Code Playgroud)

它创建services/post-name

我还使用此挂钩创建自定义页面来创建自定义页面永久链接:

function custom_base_rules() {
    global $wp_rewrite;

    $wp_rewrite->page_structure = $wp_rewrite->root . '/page/%pagename%/';
}

add_action( 'init', 'custom_base_rules' );
Run Code Online (Sandbox Code Playgroud)

它创建页面/帖子名称

现在我唯一需要做的就是为正常的 WordPress …

php wordpress permalinks wordpress-theming custom-wordpress-pages

7
推荐指数
2
解决办法
1万
查看次数

带有子项列表(类别或页面)的自定义面包屑

我目前正在构建我的第一个 WordPress 模板(使用 Bootstrap 4),我需要将面包屑集成到我的页面中。我可以看到我们目前使用的主题也提供了面包屑,但由于这些是默认的面包屑,这还远远不够。

我的意思是,默认面包屑很简单:
主页/类别/子类别/页面

我需要构建的更像是:
Home / Category / Subcategory / Page 以及,但是当您悬停 Category 或 Subcategory 时,您应该会看到当前所选选项的子项。

e.g. hovering HOME will display the available categories:

Home / Category / Subcategory / Page
  |
Category A
Category B
Category C


Or, to see the other available subcategories, it will look like this:

Home / Category / Subcategory / Page
         |
       Subcategory A
       Subcategory B
       Subcategory C
Run Code Online (Sandbox Code Playgroud)

我已经为静态页面构建了这个。代码如下所示:

<div class="d-none d-md-block">
     <div class="dropdown">
          <div class="dropdown-menu">
               <a class="dropdown-item" href="~/Category1">Category 1</a> …
Run Code Online (Sandbox Code Playgroud)

wordpress wordpress-theming custom-wordpress-pages

7
推荐指数
1
解决办法
697
查看次数

Wordpress表单处理

我需要在网站上添加一个在WordPress框架上运行的基本表单页面.

我准备好以下原材料:客户端:html表单布局,css和jquery验证代码.服务器端:处理$ _POST []数据的表单处理程序php函数.

我的问题是将此代码集成到Wordpress框架中.

我看过一些插件,但是他们做的比我想要的要多得多,而且他们有自己的验证,这很难改变.

任何人都可以建议一个好的表单插件,只允许框架钩子?或者我自己应该编写插件是值得的.

谢谢.

php wordpress custom-wordpress-pages

6
推荐指数
1
解决办法
4785
查看次数

在插件面板中将 Laravel 应用程序集成到 Wordpress 中(管理员)

我需要开发一个带有用于票务等的额外自定义门户的商业 CMS。对于 CMS 部分,选择 WordPress 似乎很方便,因为它非常好(对于它的用途,即 CMS)而且我的客户知道如何使用它。

当您向 WordPress 添加插件时,它会在管理面板中显示一个选项卡(或插件设置的链接),所以我认为我的代码可以通过这种方式集成。我对 Laravel 很熟悉也很舒服,所以我认为导航栏中可能有一个链接到我的 Laravel 应用程序,它将使用 WordPress 身份验证(就像这个方法)。

1- 这是不好的做法吗?

2-有没有更简单的方法?

3- 是否可以在 Laravel 中编写 RESTful api 并集成到 WP 中?这是否更好?

4- 是否有插件可以将 Laravel 作为插件包装到 Wordpress 中?


编辑:我的意思是“自定义插件面板”:

在此处输入图片说明

php wordpress custom-wordpress-pages laravel

5
推荐指数
1
解决办法
3311
查看次数