标签: genesis

使用 SVG 制作 WordPress 徽标

我正在尝试使用 SVG 文件作为 Wordpress 中网站的徽标,正如您从下面的代码中看到的那样,我尝试在 .svg 文件中调用此方法。不幸的是,我无法让它发挥作用......

//* Add support for custom header
add_theme_support( 'custom-header', array(
    'header_image'    => '/images/tgoc.svg',
    'header-selector' => '.site-title a',
    'header-text'     => false,
    'height'          => 110,
    'width'           => 320,
) );
Run Code Online (Sandbox Code Playgroud)

我还在 funtions.php 中执行了以下操作:

//* Enable SVG file upload
function custom_mtypes( $m ){
    $m['svg'] = 'image/svg+xml';
    $m['svgz'] = 'image/svg+xml';
    return $m;
}
add_filter( 'upload_mimes', 'custom_mtypes' );
Run Code Online (Sandbox Code Playgroud)

我知道您也可以插入 svg 代码,但我的主要问题是在哪里插入此代码?我也想尝试使用 Modernizr 进行备份。

这是CSS:

/* Logo, hide text */

.header-image .title-area {
    padding: 0;
    width: 340px;
    height: 340px;
    background: …
Run Code Online (Sandbox Code Playgroud)

css php wordpress svg genesis

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

在字体真棒图标中更改字体大小

我正在使用parallax pro genesis儿童主题,所以我在一个小部件区域工作.

我不确定我是否以正确的方式进行此操作,但我尝试在小部件区域中通过执行此操作来编写字体真棒图标:

<i class="fa fa-code fa-4x">Fully mobile responsive designs 
that adjust to fit all platforms</i>
Run Code Online (Sandbox Code Playgroud)

它有效,但文字很大.我怎样才能改变文字的大小?我试图更改字体awesome css文件夹中的.fa-code部分的字体大小,但它不起作用.有没有更好的方法可以在我的图标下写作,或者这是怎么做的?

谢谢!

css wordpress css3 font-awesome genesis

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

自定义Wordpress搜索表单模板(Genesis)

我想通过添加autocomplete="off"到搜索输入来稍微更改我的搜索表单.

我最初寻找一个简单的过滤器,如下所示:

//* Customize search form input box text
add_filter( 'genesis_search_text', 'sp_search_text' );
function sp_search_text( $text ) {
    return esc_attr( 'Search my blog...' );
}
Run Code Online (Sandbox Code Playgroud)

但因为/genesis/lib/structure/search.php没有任何变量autocomplete="%s",所以该属性无法定位.我可能不得不直接介绍它,所以我将search.php父主题文件夹复制到子主题文件夹文件夹.

该文件的原始代码如下:

<?php

/**
 * Replace the default search form with a Genesis-specific form.
 *
 * The exact output depends on whether the child theme supports HTML5 or not.
 *
 * Applies the `genesis_search_text`, `genesis_search_button_text`, `genesis_search_form_label` and
 * `genesis_search_form` filters.
 *
 * @since 0.2.0
 *
 * @return …
Run Code Online (Sandbox Code Playgroud)

php wordpress search-form genesis

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

WordPress:自定义Genesis标题

我刚刚进入Genesis Framework.

在普通主题中,如果要编辑标题,则打开该header.php文件.

但是在创世纪中,头文件不在子主题中.我环顾四周,找到了添加自定义标头支持的方法,但我需要一些指导.

下面的代码是启用自定义标头支持.我假设这进入了functions.php文件.但是我如何在这里添加代码呢?如果我想说拉入自定义字段,或者在此部分添加div,或带入滑块,该怎么办?我如何实际使用这段代码让我在子主题标题中添加html和php?

/** Add custom header support */
add_theme_support( 'genesis-custom-header', 
    array( 'width' => 960, 'height' => 100, 'textcolor' => '444', 
          'admin_header_callback' => 'minimum_admin_style' ) );
Run Code Online (Sandbox Code Playgroud)

wordpress genesis

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

“pre”标签不会缩小。不显示水平滚动条

我在我的网站上展示了很多代码。我网站的其余部分是响应式的,但“pre”标签拒绝缩小和显示水平滚动条。这是我的内容因顶部长“pre”标签而被截断的屏幕截图:

在此处输入图片说明

我正在使用溢出:水平,但您可以在示例中看到它不起作用。这是实际链接在此处输入链接描述

一旦我切换主题,它就可以正常工作!我正在使用 Genesis Framework 的子主题...

css wordpress genesis

4
推荐指数
1
解决办法
1485
查看次数

警告:preg_match():编译失败:量词未遵循 wp-includes/class-wp.php 第 222 行中偏移量 1 处的可重复项

任何包含页面类型帖子、订单类型帖子或帖子的页面都会显示此错误。这仅在托管环境中可见。我无法在本地复制错误

我已按此顺序执行了以下操作:

  1. 停用所有插件
  2. 转到设置 - >永久链接并重新保存%postname%选项
  3. 验证错误仍然存​​在,没有插件和永久链接重置。
  4. 更新了所有插件和主题。
  5. 已验证错误仍然存​​在。
  6. 在本地执行了相同的步骤,但无法复制此问题。

来自类-wp.php:

foreach ( (array) $rewrite as $match => $query ) {
    // If the requested file is the anchor of the match, prepend it to the path info.
    if ( ! empty( $requested_file ) && strpos( $match, $requested_file ) === 0 && $requested_file != $requested_path ) {
        $request_match = $requested_file . '/' . $requested_path;
    }

    if ( preg_match( "#^$match#", $request_match, $matches ) ||
        preg_match( "#^$match#", urldecode( $request_match ), $matches ) …
Run Code Online (Sandbox Code Playgroud)

php regex wordpress woocommerce genesis

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

在购物车和结帐页面上显示Woocommerce产品类别

我正在尝试将产品类别显示在购物车和每个添加产品的结帐页面上.

我的PHP知识非常有限,所以最愚蠢的解释将是伟大的:)

我已经看过woocommerce文档并搜索创世纪连接文档,但我找不到我想要的东西.

使用Genesis Woocommerce Connect和最新的woocommerce和wordpress.

不知道从哪里去..:/

php woocommerce genesis

3
推荐指数
1
解决办法
9558
查看次数

如何在 WordPress (Genesis) 中显示搜索结果的数量

我正在尝试显示通过搜索找到的帖子数量。

我找到了这段代码,$wp_query->found_posts但似乎无法使其工作,有什么建议吗?

<?php

add_action( 'genesis_before_loop', 'genesis_do_search_title' );

function genesis_do_search_title() {

    $title = sprintf( '<div class="archive-description"><h1 class="archive-title">%s %s %s</h1></div>',  $wp_query->found_posts, apply_filters( 'genesis_search_title_text', __( 'results for:', 'genesis' ) ), get_search_query() );

    echo apply_filters( 'genesis_search_title_output', $title ) . "\n";

}

genesis();
Run Code Online (Sandbox Code Playgroud)

文档:

https://codex.wordpress.org/Creating_a_Search_Page#Display_Total_Results

http://my.studiopress.com/documentation/snippets/

php wordpress genesis

3
推荐指数
1
解决办法
2939
查看次数

Wordpress - 使用insert_post时的db_insert_error

我目前正在使用每天自动更新的CSV文件,以便为客户的网站创建或更新Wordpress帖子.CSV具有列表的地址,城市,州等的标题,每行是另一个列表.目前,CSV中有大约220个属性.除了其中三个之外的所有内容都是作为帖子创建的,但其中有三个不是,而且我得到的是像这样的WP_Error - >

 WP_Error { 
       "errors"=> array{ ["db_insert_error"]=> 
                array{ [0]=> "Could not insert post into the database" }}
       "error_data"=> array { } 
       "ID"=> int(0) 
       "filter"=> "raw"
 }
Run Code Online (Sandbox Code Playgroud)

我知道插件至少可以工作,因为所有其他插件都已发布,但似乎这三个由于某种原因正在出现此错误.它们中没有任何特殊字符或其他数据可以将它们与其他行区分开来.这是我用来创建新帖子的数组和代码:

$new_post = array(
        'post_title'   => $title,
        'post_content' => wpautop(convert_chars($data['csv_post_post'])),
        'post_status'  => $opt_draft,
        'post_type'    => 'listing',
        'post_date'    => $this->parse_date($data['csv_post_date']),
        'post_excerpt' => '....',
        'post_name'    => $data['csv_post_slug'],
        'post_author'  => $this->get_auth_id($data['csv_post_author']),
        'tax_input'    => $this->get_taxonomies($data),
        'post_parent'  => $data['csv_post_parent'],
);
$pricecheck = trim($data['_listing_price']);
Run Code Online (Sandbox Code Playgroud)

$title地址,城市和州的预加入字符串在哪里.

if (!get_page_by_title( $new_post['post_title'], 'OBJECT', 'listing') && $pricecheck != "") {
    $id = wp_insert_post($new_post, …
Run Code Online (Sandbox Code Playgroud)

php csv wordpress genesis

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

标签 统计

genesis ×9

wordpress ×8

php ×6

css ×3

woocommerce ×2

css3 ×1

csv ×1

font-awesome ×1

regex ×1

search-form ×1

svg ×1