Wordpress not saving changes to code - html

I was given an assignment to add a payfast "pay now" button. I managed to generate a code for the button and it works just fine. I had to integrate the pay now button into the companies website. The button is coded in HTML and the company's website is done in wordpress. so my problem now is that when I add the code to a page in the wordpress site, some lines in the code disappear. I added the code in the text tab and not the visual tab.
Please help! I do not know what the problem is now.

If you're adding the code into a "rich text editor" like WordPress's main post body field, it will likely edit the code for what it thinks are display purposes.
See if there is a visual and text tab at the top right of the post editor and drop your code into the text tab, instead.
Alternatively, create a shortcode that renders your button's HTML.
// functions.php
// ...
add_shortcode('payfast', 'payfast_renderer');
function payfast_renderer() {
echo '<button class="btn btn--lerato btn--payfast">Pay Here</button>';
}
You could then render that HTML by typing [payfast] into the content editor on a post page.
Read the WP Codex entry on shortcodes for a little more background on how shortcodes work! Reliable way to render page content that relies on HTML and even server-side code.
[WP Codex Shortcode API]

Related

How to edit WordPress v4.9.5 page's html code

I want to make some changes to the page. So I tried following this
How to edit WordPress page's html code but this is a different Wordpress version and the Editor tab is missing. I can't get editable html code behind the page.
Here's a sample image:
My task is to change the Image goes here to an actual image. The style of the page is similar to other pages but they only differ with the content and the image.
In Wordpress, I go to the Pages then edit but there's only codes for the contents.
Here's an image:
I have to replace the left box to an actual image. And as you can see in the Appearance Tab there's no Editor Tab. How can I edit the image part and do that to the new version of Wordpress? Please help me with this. Sorry I'm new in Wordpress. Thanks.
You can try:
Appearance Tab --> Editor --> Edit theme so if you want edit it can use FTP hosting.
File Manager — WordPress Plugins or http://www.bestplugins.com/cms/wordpress-ftp-plugin.html

Creating a plain html home page AMP with WordPress running the other pages

Gday
I like to know how you would go about creating a home page in plain html and have WordPress run the other pages?
The reason is I’d like to create a solely plain html website but I need WordPress for my contact page it has a large form on it and I use a plugin to generate it and forms are a bit beyond my knowledge at the moment to create a contact page myself.
(I have tried creating a template page but then WordPress adds unnecessary code [from plugins ] and makes the AMP invalid)
Honestly I'd try and keep it self contained in WordPress itself.
If for some reason you really want a separate HTML/PHP Homepage, follow these steps:
Add a my-homepage.php file to your /wp-content/themes/ACTIVE-THEME directory
Inside that file put the following code:
Add a new page (Pages > Add New)
Give it a recognizable name like "My Homepage"
In the "Template" selector on the right hand side, pick "My HTML Homepage" and click Publish
Go to Settings > Reading, change Your homepage displays to A static page and pick the page you just made
Now you can add your own code as you see fit. Nothing "WordPress" related will get loaded or hooked in since there's no functions on that file - so you're free to code HTML (or PHP) to your heart's content.
You can see a bit more indepth answer over on WPSE: https://wordpress.stackexchange.com/questions/296592/how-to-use-custom-html-file-instead-of-wordpress-homepage

Wordpress customize specific site

I made a little game using html and new I´m looking to publish it on my wordpress site. There is only on problem though, I don´t know how to add a page in html code. If I add a new Site I can only edit the text and attach pictures, but is there a way to add a complete page under a domain like www.example.com/page ?
Upload the HTML file to your website's root directory using FTP. If you name it game.html, you should be able to open the file by navigating directly to it www.example.com/game.html.
You go to My Page. Then there is a submenu Publish. Click on the button Add next to Pages. When you did that, there is that small menu in the middle where you can choose several options such as header, bold, italics, etc.. In the top right corner of that menu, there are two options: Visual | HTML. Just click on HTML and you can add HTML code.

How to post script at blogger, create script view at template

Someone know how to create script view at blogger.com?
i need to post script like this picture at my blog
Do you mean add a script too your blog? It can be done with it
With gadget
choose 'Tata Letak' menu on left, and on your page view find 'Tambah Gadget' and choose 'HTML/Javascript' then add your script.
Edit whole page
Or you can edit your whole page, choose 'Template' menu on left and click 'edit HTML' button, then add your script.
Then you can add a syntax highlighter, depending on this article
http://www.bungfrangki.com/2015/07/membuat-syntax-highlighter-otomatis-di-blogger.html
http://www.mybloggertricks.com/2015/04/SyntaxHighlighter-Shortcode-for-Blogspot.html
I guess it should have code option but If it doesn't When you are going to add new post there's an option to see the HTML codes in your post Go there and put your codes in <code> tag.
To display codes in blogger posts, from your editor press Quote button and insert your code. this will put your code between <blockquote> </blockquote>
image description here
and you can style the <blockquote> with CSS.

How to edit WordPress page's html code

I can't get editable html code behind the page. I want to make some changes to the page. Web site is hosted in the remote server. Someone assigned this task. There is empty editor when open edit page as below image.
Also I added plugin and actived it but can't get the result.
The picture you posted is of the WYSIWYG editor, which is only for adding content to the page.
If you want to edit the layout of the page itself you have 2 options -
Minor page edits to appear across all pages on the site - Go to Appearance -> editor -> page.php and then edit the code to suite your needs.
Large page edits to appear on one or two pages -
Get access to the files
Duplicate page.php with a different name
Edit code
When you go to add a new page you should have an option to pick a page template. Choose the page template you just created.
If you know exactly what you are doing, you can use Chrome "Inspect" feature, and change the HTML of the content inside the WordPress WYSIWYG Editor. After injecting your HTML, click Preview or Publish and your changes will be saved correctly.
In WordPress 5.5.3, you should be able to click the three dots on the top right, then select Code editor. Alternatively, press Ctrl+Shift+Alt+M.