Max Power
Max Power

Reputation: 153

How to edit the html (php?) of a wordpress page

This is a hard question to phrase because I know that html is generated by the PHP files inside the themes.

I'm trying to add a line break and can do so going into classic mode while editing a page but this line break gets removed after time? So now I'm trying to go to the source and add it there (also any changes I want to make in the future).

Is this possible in WordPress or simply a feature we don't have? Please let me know if I'm wasting my time trying to do this.

Here is the php of my page.php file.

<?php
/*
* Content Page
*
* @package adios
* @since 1.0
*/
get_template_part('templates/global/page-before-content');
while ( have_posts() ) : the_post();

the_content();

wp_link_pages( array(
'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'adios' ),
'after'  => '</div>',
) );

// If comments are open or we have at least one comment, load up the comment template
if ((comments_open() || get_comments_number()) ) :
comments_template();
endif;
endwhile;
get_template_part('templates/global/page-after-content');

I don't know php only html and css so this is confusing to me, I'ved tried going to page-before-content and after-content but those don't seem to be useful. Also, yes I'm using a ftp server.

Here's the php from page-before-content.php

$layout = adios_get_opt('main-layout');
if ($layout == 'left_sidebar'): ?>
<div class="row">
<?php get_sidebar(); ?>
<div class="col-md-8">
<?php elseif ($layout == 'right_sidebar'): ?>
<div class="row">
<div class="col-md-8">
<?php else: ?>

<?php endif; ?>

and page-after-content.php

$layout = adios_get_opt('main-layout');
if ($layout == 'left_sidebar'): ?>
</div>
</div><!-- .row -->
<?php elseif ($layout == 'right_sidebar'): ?>
</div>
<?php get_sidebar(); ?>
</div><!-- .row -->
<?php else: ?>

<?php endif; ?>

Upvotes: 1

Views: 287

Answers (2)

Vasim Shaikh
Vasim Shaikh

Reputation: 4512

I have edited my answer this include number several ways,There is number of issue with tinymce plugin.Sometime its cause issue with some theme.I hope this following things are more helpful.

There are a couple of different ways.

  • One is to use a slightly different editor:

http://wordpress.org/plugins/tinymce-advanced/

  • The other way is to disable the function that performs the removal. This is as simple as adding the following to your functions.php file:

remove_filter( 'the_content', 'wpautop'); remove_filter( 'the_excerpt', 'wpautop');

  • Yet another way is to use this plugin to enable/disable the filters on a per post/page basis:

https://wordpress.org/plugins/wpautop-control/

Upvotes: 1

Stanley Wang
Stanley Wang

Reputation: 1164

You could install TinyMCE Advanced. It has a option to keep the <p> and <br> tag.

enter image description here

Upvotes: 2

Related Questions