Website size decreases while converting to WordPress - html

I am converting an HTML site to WordPress, and it's done. Now it seems like the total size is reduced, but the units are correct (same as the original HTML, i.e. 980px width etc.).
Please help me with that.
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title><?php
/*
* Print the <title> tag based on what is being viewed.
*/
global $page, $paged;
wp_title( '|', true, 'right' );
// Add the blog name.
bloginfo( 'name' );
// Add the blog description for the home/front page.
$site_description = get_bloginfo( 'description', 'display' );
if ( $site_description && ( is_home() || is_front_page() ) )
echo " | $site_description";
// Add a page number if necessary:
if ( $paged >= 2 || $page >= 2 )
echo ' | ' . sprintf( __( 'Page %s', 'twentyten' ), max( $paged, $page ) );
?></title>
<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
</head>

Check your styles once again. May be other styles may contradict with the width. Could you please provide more information excatly?

Yes, more info would be helpful. The chances are good WP is linking to another stylsheet you don't know about. Are you using a theme? It's probably got it's own stylesheet, or another plugin is adding it's own style.

Related

Why is my css file not being read in yii mailer?

I have an email controller with the following function inside
public function actionCreate()
{
$invoice_number_1 = Yii::$app->request->post('invoice_number_1');
$part_number_1 = Yii::$app->request->post('part_number_1');
$quantity_1 = Yii::$app->request->post('quantity_1');
$reason_code_1 = Yii::$app->request->post('reason_code_1');
// There are more of these but they work fine
Yii::$app->mailer->compose(
[
'html'=>'email/myfile.php'
],
[
'invoice_number_1' => $invoice_number_1,
'part_number_1' => $part_number_1,
'quantity_1' => $quantity_1,
'reason_code_1' => $reason_code_1,
// There are more of these but they work fine
])
->setFrom([Yii::$app->params['fromEmailAddress'] => Yii::$app->params['fromEmailName']])
// There are more of these but they work fine
->send();
}
The html file this links to is identical to the one is the same as in the example on the yii website but with two content security policy meta links and a link to my css as follows:
<?php
use yii\helpers\Html;
/* #var $this \yii\web\View view component instance */
/* #var $message \yii\mail\MessageInterface the message being composed */
/* #var $content string main view render result */
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?= Yii::$app->charset ?>" />
<meta http-equiv="Content-Security-Policy" context="style-src 'self' 'unsafe-inline'" />
<meta http-equiv="Content-Security-Policy" content="style-src-elem 'self' 'unsafe-inline'">
<link rel="stylesheet" type="text/css" href="../credit_request/credit_request.css" />
<title><?= Html::encode($this->title) ?></title>
<?php $this->head() ?>
</head>
<body>
<?php $this->beginBody() ?>
<?= $content ?>
<?php $this->endBody() ?>
</body>
</html>
<?php $this->endPage() ?>
I have also changed the html file to just
<?php
use yii\helpers\Html;
/* #var $this \yii\web\View view component instance */
/* #var $message \yii\mail\MessageInterface the message being composed */
/* #var $content string main view render result */
?>
<?php $this->beginPage() ?>
<?php $this->beginBody() ?>
<?= $content ?>
<?php $this->endBody() ?>
<?php $this->endPage() ?>
and it gives the same result.
The email/index.php page is as follows
<!DOCTYPE html >
<html >
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="Content-Security-Policy" content="style-src 'self' 'unsafe-inline'">
<meta http-equiv="Content-Security-Policy" content="style-src-elem 'self' 'unsafe-inline'">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="./credit_request.css" />
</head>
<body>
<div class="container_1">
<span class="numbers_1" ><?php echo strtoupper($invoice_number_1) ?>   -   <?php echo strtoupper($part_number_1) ?>   x   <?php echo strtoupper($quantity_1) ?>  </span>
<span class="reason_code_1"><?php echo strtoupper($reason_code_1)?></span>
</div>
</body>
</html>
When I send an email I get the following error referring to the link in the html file:
Refused to load the stylesheet 'http://192.168.0.90/email/index.css' because it violates the following Content Security Policy directive: "style-src 'unsafe-inline'". Note that 'style-src-elem' was not explicitly set, so 'style-src' is used as a fallback.
I also get the following three errors referring to the link in the email/index.php file:
The Content Security Policy 'style-src 'self' 'unsafe-inline'' was delivered via a element outside the document's , which is disallowed. The policy has been ignored.
The Content Security Policy 'style-src-elem 'self' 'unsafe-inline'' was delivered via a element outside the document's , which is disallowed. The policy has been ignored.
Refused to load the stylesheet 'http://192.168.0.90/otrs/index.css' because it violates the following Content Security Policy directive: "style-src 'unsafe-inline'". Note that 'style-src-elem' was not explicitly set, so 'style-src' is used as a fallback.
My css file is just
.container_1 {
background-color: red;
}
How do I get the css to be recognised?

How do I initialize the `<base>` tag correctly

I want to add the <base> tag inside the html <head>. I already have a config.inc.php file, so might as well add it there, like so:
config.inc.php:
$config = [
'home' => [
'base' => 'http://' . $_SERVER['SERVER_NAME'] . dirname($_SERVER['PHP_SELF'])
],
'html' => [
'lang' => 'es_ES',
'charset' => 'utf-8'
]
];
and this is how i add it on the HTML </head>
<head>
<meta charset="<?php echo $config['html']['charset']; ?>">
<base href="<?php echo $config['home']['base']; ?>">
</head>
The question is how do I initialize the <base> tag correctly on my config.inc.php file?
I do it like this:
'http://' . $_SERVER['SERVER_NAME'] . dirname($_SERVER['PHP_SELF'])
Is there a better way, or not... Do i need a slash (/) at the end?

Symfony2/html2pdf bundle - CSS ignored in pdf file

I'm using html2pdf bundle to generate pdf File. I followed the documentation. The bundle works fine my pdf is generate. But the css is ignored. I've my css in an external file and bootstrap cdn. But there is not changes.
However I create a route to the view supposed to be converted in PDF, and the css works fine in the HTML view.
My controller :
public function invoicPdfAction($id){
$em = $this->getDoctrine()->getManager() ;
$invoic = $em->getRepository('EcommerceBundle:Orders')->findOneBy(
array(
'user' => $this->getUser(),
'validate' => 1,
'id' => $id
));
if(!$invoic){
$this->addFlash('danger', 'La facture n\'existe pas ');
return $this->redirect($this->generateUrl('_invoic_user'));
}
$html = $this->renderView('UsersBundle:Public:User/invoicPDF.html.twig', array('invoic'=>$invoic));
$html2pdf = $this->get('html2pdf_factory')->create();
$html2pdf->pdf->SetDisplayMode('real');
$html2pdf->pdf->setSubject('Facture : My E-Commerce');
$html2pdf->pdf->setTitle('Facture : n°'. $invoic->getReference());
$html2pdf->writeHTML($html);
$html2pdf->Output('invoic.pdf') ;
return new Response($html2pdf->Output('invoic.pdf'), 200, array('Content-Type' => 'application/pdf'));
}
My view invoicPDF.html.twig
<!DOCTYPE html >
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Facture</title>
<link rel="stylesheet" href="{{ asset('css/style_invoic.css') }}">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahauwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">
</head>
<body>
<div class="container">
<div class="row">
<h1> Facture de la commande n° : {{ invoic.reference }} </h1>
</div>
....
</div>
</body>
</html>
config.yml
ensepar_html2pdf:
orientation: P
format: A4
lang: fr
unicode: true
encoding: UTF-8
margin: [10,15,10,15]
What I missed ?
Thanks in advance
html2pdf ignore the extern files
You must do write your css in your pdf thanks to : /* css */

Crazy 403 Forbidden Error on Wordpress Site

Just installed a new theme on my site: www.rivertam.co
For some reason I keep getting this 403 Forbidden error at the top of it.
I've tried removing the htaccess file like some have suggested, nothing happens. Really no idea why it's there.
Can anyone give me any suggestions?
Happy to paste any PHP you may need. Just let me know!
Header.php code:
<!DOCTYPE html>
>
>
>
>
<title><?php wp_title( ' ', true, 'right' ); /* filtered in libraries/filers.php */ ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=<?php bloginfo( 'charset' ); ?>" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<link rel="shortcut icon" href="<?php echo get_template_directory_uri(); ?>/favicon.gif" />
<link rel="apple-touch-icon" href="<?php echo get_template_directory_uri(); ?>/apple-touch-icon.png" />
<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
<?php
// See functions.php for CSS / JAVASCRIPT information
wp_head(); // do not remove this
?>
>
<div id="branding_wrap">
<header id="branding">
<div class="container">
<?php
// Grab the column settings from theme settings to determine the logo/menu container sizes
$logo_columns = $menu_columns = "eight";
$header_layout = cudazi_get_option( 'header_layout', 'eight|eight' );
$header_layout = explode('|', $header_layout);
if ( is_array( $header_layout ) ) {
$logo_columns = $header_layout[0];
$menu_columns = $header_layout[1];
}
?>
<hgroup class="<?php echo $logo_columns; ?> columns">
<h1 id="logo"><?php echo cudazi_get_logo(); ?></h1>
<?php if ( ! cudazi_get_option( 'disable_tagline', false ) ) { ?>
<h2 id="site-description"><?php bloginfo( 'description' ); ?></h2>
<?php } ?>
</hgroup>
<nav class="<?php echo $menu_columns; ?> columns" id="navigation" role="navigation">
<?php wp_nav_menu( array( 'menu_class' => 'sf-menu clearfix', 'theme_location' => 'primary', 'fallback_cb' => 'cudazi_menu_fallback' ) ); ?>
<?php echo cudazi_alternate_menu( array( 'menu_name' => 'primary', 'display' => 'select' ) ); ?>
</nav>
</div><!--//container (skeleton) -->
</header><!--//header-->
</div>
<section id="main">
Do you include any other files programmativally? (AJAX?)
If yes I would first check permissions! Files have to be world-readable (in normal setups) to be delivered through web...

Switching to Codeigniter HMVC - Undefined functions?

I have setup a fresh install of codeigniter 2x and modular extensions (https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc/wiki/Home)
It is my first time using HMVC, the decision to move from MVC to HMVC was to give myself more control of my login, admin, and members areas.
I have created my first controller in HMVC like so....
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Home extends MX_Controller {
function __construct()
{
parent::__construct();
$this->load->model('Content_model');
}
public function index()
{
$this->load->view('includes/template');
}
}
and a view like:
<?php echo doctype(); ?>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $pagecontent['seo_title']; ?></title>
<meta name="description" content="<?php echo $pagecontent['seo_description']; ?>" />
<meta name="keywords" content="<?php echo $pagecontent['seo_keywords']; ?>" />
<meta name='robots' content='all' />
<link rel="icon" type="image/ico" href="<?php echo base_url("images/favicon.png"); ?>" />
<?php echo link_tag('css/style.css'); ?>
<script type="text/javascript" language="javascipt" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
<script type="text/javascript" language="javascript" src="<?php echo base_url("js/jquery.validate.min.js"); ?>"></script>
<script type="text/javascript" language="javascript" src="<?php echo base_url("js/main.js"); ?>"></script>
</head>
<body>
<?php $this->load->view('includes/notify'); ?>
<div id="topbar">
<?php $this->load->view('includes/topbar'); ?>
When I try and view the page in my browser I get the following error:
Fatal error: Call to undefined function doctype() in C:\xampp\htdocs\mintfifty\application\modules\site\views\includes\template.php on line 1
The code has worked in all my previous codeigniter (mvc) projects but not (hmvc) why is it not working in HMVC? What am I doing wrong?
This issue is not likely to be caused by HMVC. doctype() function is defined in html helper and it seems that You have not loaded it (Unless you have auto-loaded it). Just load the html helper in your controller and it should work fine.
public function index()
{
$this->load->helper('html');
$this->load->view('includes/template');
}