视觉/HTML 编辑器文本和图像问题

发布于 2024-09-16 10:31:56 字数 1583 浏览 2 评论 0原文

这是我的第一个 WordPress 3 网站。我目前正在为客户开发一个网站,我遇到了以下与 WordPress 页面有关的问题,这些页面分配了我创建的默认自定义 WordPress 页面模板。

我创建的整个主题来自 Starkers 主题。

问题是:

1) 对于我的“关于我们”页面,我已将所有 CSS 样式放置在“关于我们”仪表板页面指向的自定义页面模板中,但已输入我在放置之前在浏览器中创建和测试的 RawHTML将其放入使用 RawHTML 插件的页面 HTML 编辑器中。

问题是,在第一次使用 start raw 和 end raw 标签粘贴我的 HTML 代码时,所有内容在预览模式下看起来都很好,但在可视化编辑器中则不然 - 所有格式都丢失了。

此外,当我在可视化编辑器中编辑文本时,我的整个布局都混乱了。为什么?这里担心的是,我最终希望我的客户对文本进行所有更新,但如果一切都变得混乱,那么使用 WordPress 作为 CMS 有何意义?

我真的很想确保任何更改都不会弄乱页面格式的其余部分,看起来确实如此。

2)添加和删除图像似乎也会弄乱页面格式,我再次不明白为什么?如果我有一个向右对齐的图像并使用 WordPress 图像上传器来替换现有图像,那么页面格式会再次混乱。

解决这个问题的唯一方法是使用外部 html 文件进行更改,然后将其复制并粘贴回页面 HTML 编辑器,这再次达不到目的。

我的客户已向我提供了他们最初需要的 MS Word 格式的所有内容,但基于上述问题,我在获取正确的格式时遇到了很多困难。

最重要的是,我希望我的客户更新我所有 WP 页面中的所有内容,但我也想确保如果他这样做(文本和/或图像)不会破坏页面格式。

来自 Adam 的回复

为了让我克服动态内容方面的障碍,我希望我的客户在不破坏现有页面内容的情况下进行更改。

根据您的回复和如上所述,我已经使用了 Starkers 主题,我实际上已经完成了您的建议,也就是说,我为我的“关于我们”页面创建了一个名为 About-Us.php 的特定模板页面,然后我在其中在我的 WP 仪表板的页面下创建了一个“关于我们”页面,然后将此模板分配给它。

所以这是我不确定的领域,以便我了解该过程,即动态内容。

我的客户向我提供了一份 MS Word 文档,其中包含他想要在“关于我们”页面中显示的内容(带有样式的格式化文本),以及他想要与页面最右侧对齐的两张图像。

现在,根据他想要的内容和我的 About-Us.php 页面模板,我将该内容放置在哪里,以便他拥有我的客户所需的所有正确的样式和布局,这也将允许他走上正轨,而无需联系我,对他的内容以及他的两个图像进行更改(即更改图像),而不破坏/混乱当前页面格式,也就是说,他在 MS Word 中呈现内容的方式就是我想要的方式即使他手动更改,也要查看实际站点?

1) 如何使用自定义 About-Us.php 页面模板来完成此操作?

2) 他的 MS Word 中的内容放置在 WordPress 中的何处 - 仪表板页面(html/可视化编辑器)或已定义样式 CSS 的 About-Us.php 页面模板中?

3) 我的客户可以在哪里编辑页面内容(文本/图像)并确保格式不会丢失?

我不知道如何将内容导入 WordPress 以及如何确保进行任何更新后页面格式不会丢失。

This is my first WordPress 3 site. I'm currently developing a site for a client and I am faced with the following issues with regards to WordPress pages that have a default custom WordPress page template assigned to them, that I have created.

The whole theme I created was from Starkers Theme.

The concerns are:

1) For my About-Us page, I have placed all my CSS styles in my custom page template that the About-Us Dashboard Page points to but have entered my RawHTML that I created and tested in a browser prior to placing it into the Page HTML Editor, which is using the RawHTML plugin.

The problem is, on first pasting my HTML code using start raw and end raw tags, all looks fine in preview mode but not in the Visual Editor - all format is lost.

Furthermore, when I edit the text in the Visual Editor, my whole layout is all messed up. Why? Concern here is, I eventually would like my client to do all updates to text but if it jumbles all up, then what's the point of using WordPress as a CMS?

I would really like to ensure that any changes does not mess up the rest of the page format, which it seems to.

2) Adding and removing images also seem to mess the page format and again I don't understand why? If I have an image aligned to the right and am using WordPress Image uploader to replace an existing image, again the page format is messed up.

The only way around this, is to have external html files where you make the changes and then copy and paste this back into the Page HTML Editor, which again defeats the purpose.

My client has given me all the content they initially require in MS Word format but I am having a lot of difficulties getting the format correct based on above issues.

Bottom line is, I want my client to update all content in all my WP Pages but I also want to make sure that if he does (text and/or images) does not break the page formatting.

From Adam's response

In order to get me past this hurdle with regards to dynamic content that I would like my client to change without spoiling existing page content.

Based on your response and as mentioned, I have used the Starkers Theme, I have actually done what you have suggested, that is, I have created a specific template page for my About Us page called About-Us.php, where I have then created an About-Us page in my WP dashboard, under pages and then assigned this template to it.

So this is the area that I am unsure about, so that I understand the process, i.e. the Dynamic Content.

My client has provided me a MS Word document of the content (formatted text with styling) he wants in this "About-Us" page, together with two images the he wants aligned to the right-most of the page.

Now based on this content that he wants and my About-Us.php page template, where do I place this content so that he has all the correct styling and layout required by my client, which will also allow him down the track, without contacting me, to make changes to his content as well as to his two images (i.e. change images), without spoiling/jumbling the current page format, that is, the way he has presented the content in his MS Word is the way I want the actual site to look, even when he makes manual changes to?

1) How would this be done using a custom About-Us.php page template?

2) Where is the content from his MS Word placed in WordPress - in the dashboard page(html/visual editors) or in the About-Us.php page template that has style CSS defined?

3) Where can my client then go and edit the Page content (text/images) and ensure that formatting is not lost?

I am at a loss with how to get the content into WordPress and how to ensure that page formatting is not lost after any updates are made.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

捂风挽笑 2024-09-23 10:31:56

不是 100% 确定你在做什么,但根据我的经验,将所有页面的 html 发布到 HTML 编辑器中并不好

如果你打开核心文件(最好创建子主题 - 但对于 WordPress 新手来说,这可能看起来很复杂)您可以编辑某些页面。 wp-内容>主题> header.php 中的yourtheme

您可以将外部 css 链接以及 javascript 放入其中。
(一个例子是 - 不要触摸 php)

<script type="text/javascript src="<?php bloginfo('template_directory'); ?>/library/js/jquery.js" "></script>

style.css 是你制作的每个页面都会使用的主要样式表,除非另有说明

如果你有自己的设计(即不使用其他主题),你可以编辑 page.css 。 php 将所有静态 html / php 放入其中,并使用页面挂钩 获取动态内容。或者您可以为每个页面创建特定的模板页面。

为此,您创建一个新的 .php 文件并将其命名为 template-something.php 并将其放在页面顶部:

 /*
 Template Name: Choose A name
*/

然后在 wp 仪表板中的编辑页面下..在右侧是选择模板的选项。您的新页面应该在那里,并且您对其所做的任何更改都会显示出来。

由于有点匆忙,抱歉无法发布链接。
只要继续在线阅读,您就会很快掌握。
ps 我使用 Hybrid 作为主题..它剥离了所有内容,让您可以更轻松地编写自己的主题..并且有大量的钩子(提供 wordpress 钩子并过滤谷歌)

Not 100% sure what you are doing but posting all the page's html into the HTML editor is not good as far as my experiance goes

If you open up the core files (best to create child themes - but for wordpress newbies this can seem complex) you can edit certain pages. wp-content > themes > yourtheme

in header.php you can put ur external css links in there, as well as javascript.
(an example would be - dont touch the php)

<script type="text/javascript src="<?php bloginfo('template_directory'); ?>/library/js/jquery.js" "></script>

style.css is the main stylesheet that everypage u make will use unless told otherwise

If you have your own design (i.e. not using some1 elses theme) you can either edit page.php to put all the static html / php into it and use page hooks to get dynamic content. Or you can create a specific template page for each page.

to do this you create a new .php file and call it template-something.php and put this at the top of the page:

 /*
 Template Name: Choose A name
*/

then in the wp dashboard, under edit page.. on the right there is an option to select a template. your new page should be there and any changes u make to it show up.

in a bit of a rush, so sorry i cannot post links.
just keep reading things online and you will pick it up fast.
p.s. I use Hybrid as a theme.. it strips everything allowing you to code your own theme easier.. and has loads of hooks (give wordpress hooks and filters a google)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文