标签: wordpress-theming

获得纯HTML/CSS版本的Wordpress主题,没有PHP?

在哪里可以找到优雅的Wordpress(或不是Wordpress,但类似的风格)主题的纯HTML/CSS格式,没有所有的PHP?

谢谢.

html css wordpress wordpress-theming

0
推荐指数
1
解决办法
1855
查看次数

在页面模板中按类别获取自定义帖子类型

我已经创建了一个包含类别和子类别的自定义帖子类型,我需要做的是列出页面模板中给定子类别或类别的帖子标题和图像.

我已经获得了自定义帖子类型中所有列出的项目,但我不确定如何进一步...任何帮助赞赏.

<?php 
$args = array( 'post_type' => 'portfolio', 'posts_per_page' => 10 );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
the_title();
echo '<div class="entry-content">';
the_content();
echo '</div>';
endwhile;
?>
Run Code Online (Sandbox Code Playgroud)

php wordpress wordpress-theming

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

WP get_footer函数不显示页脚

我正在努力学习如何构建自己的WordPress主题.我已经完成了一些教程,但我遇到了麻烦.我似乎无法弄清楚我做错了什么.当我在我的"home.php"所在的文件中使用我的页脚html时,它可以正常工作.当我尝试将它分开然后将页脚html放在"footer.php"中并使用"get_footer();" 功能,页脚根本没有出现,明显或在代码中......它不在那里.我想知道是否还有其他一些我忽略了让页脚工作的东西?如果没有那么当我将代码分成不同的主题部分/文件时,什么可能导致页脚不显示?

这是home.php的代码:

    <?php
/*
  Template Name: Front Page
 */
?>

<?php get_header(); ?>

<?php get_template_part('nav'); ?>

<div id="content"><!-- Start Content -->

    <?php get_sidebar('left'); ?>

    <div id="middle-column" class="grid_8"><!-- Main Content Begins Here -->

        <?php if (have_posts()) : while (have_posts()) : the_post(); ?><!-- Start Loop -->
                <div class="post">
                    <h2 id="post-<?php the_ID(); ?>"><?php the_title(); ?></h2>
                    <div class="entrytext">
                        <?php the_content('<p class="serif">Read the rest of this page &raquo;</p>'); ?>
                    </div>
                </div>
                <?php
            endwhile;
        else:
            ?>
            <?php _e('This page does not appear to have been …
Run Code Online (Sandbox Code Playgroud)

wordpress wordpress-theming footer

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

Wordpress使用functions.php仅在特定页面模板上运行功能

我有一个以下代码来检查当前使用的文件是否是tmp_home_page.php,但是当我这样做echo $template_file;时显示functions.php

    add_action('template_redirect', 'are_we_home_yet', 10);
    function are_we_home_yet(){
            global $template;
            $template_file = basename((__FILE__).$template);
            if ( is_home() && $template_file == 'tmp_home_page.php' ) {

            // do stuff

            }
     }
Run Code Online (Sandbox Code Playgroud)

知道如何确保我do stuff只在主页上运行,并且当使用给定的模板时?

wordpress wordpress-theming

0
推荐指数
1
解决办法
5847
查看次数

解析错误:语法错误,文件意外结束但没有错误

这是wordpress主题的index.php的php代码:

<section id="content">
    <?php
        $i=1;
        while(have_posts() && i < 7):the_post();
        $tumbUrl = '';
        if(has_post_thumbnail())
        {
            $tumbUrl = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );
        }
        if(i < 4):
    ?>
    <div id="row1">
        <div id="tile<?echo $i?>" class="tile">
            <div id="img<?echo $i?>" class="tileimage"<?if($tumbUrl != ''):?> style="background-image:<?echo $tumbUrl; ?>"<?endif;?>></div>
            <div id="text<?echo $i?>" class="tiletext"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></div>
        </div>
    </div>
    <?
        else:
    ?>
    <div id="row2">
        <div id="tile<?echo $i?>" class="tile">
            <div id="img<?echo $i?>" class="tileimage"<?if($tumbUrl != ''):?> style="background-image:<?echo $tumbUrl; ?>"<?endif;?>></div>
            <div id="text<?echo $i?>" class="tiletext"><a href="<?php the_permalink() ?>" …
Run Code Online (Sandbox Code Playgroud)

php wordpress wordpress-theming

0
推荐指数
1
解决办法
5793
查看次数

wordpress PHP主题功能开关带来了整个网站

2行代码切换broght我的整个网站.我想做的就是切换博客的摘录长度.所以我在一个函数中关闭了两行代码但是偶然丢失了那些代码行!这是一场灾难.我可以登录wp-admin,网站上的一些链接不起作用.

这是我切换的代码行:

function avada_excerpt_length( $length ) {

(this used to be two lines of short code, i remember the code $length was   somewhere in it)

}
Run Code Online (Sandbox Code Playgroud)

这就是我用它取而代之的

function avada_excerpt_length( $length ) {

return: 55;

}
Run Code Online (Sandbox Code Playgroud)

php wordpress wordpress-theming

0
推荐指数
1
解决办法
107
查看次数

搜索框和提交按钮未在CSS中对齐

我在我的wordpress网站上添加了一个搜索框,但由于wordpress中有很多默认样式,我似乎无法设置机器人框和提交按钮对齐.

目前提交按钮比我的搜索框略高,但我没有为我的按钮指定任何边距或填充.

该网站在线; http://sennheiser-apart.com

这些是我目前在我孩子主题的css文件中搜索内容的css行.

button {
    border:none;
    padding:6px;
}

input {
    height:28px;
    border:none;
}

input[type="submit"]{
    border:none;
    background-color:#00AFDD;
    height:28px;
    color:#fff;
    font-size:18px;
    margin:0px;
}

input[type="submit"]:hover{
    background-color:#ADAFB2;
}
Run Code Online (Sandbox Code Playgroud)

即使在我的页面上搜索并在wordpress使用的其他文件中寻找一系列样式也无济于事,我只是找不到导致这种情况的原因.有人有线索吗?我怎样才能解决这个问题?

html css search wordpress-theming

0
推荐指数
1
解决办法
3660
查看次数

为什么我不能在这个WordPress主题中添加CSS样式?

我正在尝试将CS​​S样式添加到我正在开发的WordPress主题中,如本教程所示:http://www.wpbeginner.com/wp-tutorials/how-to-properly-add-javascripts-and-styles -in-wordpress /但似乎不起作用,我不能理解为什么.

所以这是我个人主题的head.php文件:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
<title><?php bloginfo('name'); ?> <?php if ( is_single() ) { ?> » Blog Archive <?php } ?> <?php wp_title(); ?></title>
<meta name="generator" content="WordPress <?php bloginfo('version'); ?>" /> <!-- leave this for stats -->

<!--
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); …
Run Code Online (Sandbox Code Playgroud)

css php wordpress wordpress-theming content-management-system

0
推荐指数
1
解决办法
461
查看次数

为什么wp_enqueue_script会忽略我的'wp_head'钩子?

我想和css_head_scriptsjs_head_scripts附加wp-head
但Wordpress完全忽略它?我错过了什么吗?

    function css_head_scripts() {
        wp_enqueue_style( 'Master Stylesheet', get_template_directory_uri()."style.css" );
    }
    function js_head_scripts() {
        echo '<!--[if lt IE 9]>';
        wp_enqueue_script( "HTML5 Shiv", "https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js" );
        wp_enqueue_script( "Respond.js", "https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js" );
        echo '<![endif]-->';
    }
    function js_footer_scripts() {
        wp_enqueue_script( "My jQuery", "http://code.jquery.com/jquery-1.10.2.min.js" );
        wp_enqueue_script( "Bootstrap", get_template_directory_uri()."/js/bootstrap.min.js" );
    }
    add_action('wp_head', 'css_head_scripts');
    add_action('wp_head', 'js_head_scripts');
    add_action('wp_footer', 'js_footer_scripts');
Run Code Online (Sandbox Code Playgroud)

wordpress wordpress-theming

0
推荐指数
1
解决办法
1064
查看次数

在不创建新表的情况下为WordPress插件存储变量

我正在创建一个自定义主题,它提供了一种更改WordPress网站主页布局的方法.我想给用户3个选项,然后根据该选择我将以不同的方式设置主页的样式.我知道如何让用户选择布局,但我不想创建一个新表来存储这一条信息.还有另一个地方我可以为我的主题存储这个变量吗?谢谢.

php mysql wordpress wordpress-theming wordpress-plugin

0
推荐指数
1
解决办法
1618
查看次数