Articles of wp head

How to use only scripts from new theme?

I’m a bit new to WordPress so please forgive me if is a duplicate question. I created new theme with simple file structure: functions.php footer.php header.php index.php style.css js/ I’m trying to use only custom scripts that i define here: function mytheme_enqueue_scripts() { wp_register_script(‘underscore’, get_template_directory_uri().’/js/underscore.js’, array(), null, false); wp_register_script(‘backbone-core’, get_template_directory_uri().’/js/backbone.js’, array(‘underscore’), null, false); wp_register_script(‘backbone-app’, get_template_directory_uri().’/js/app.js’, […]

Fatal error: Call to undefined function get_post() with ajax

I have an index.php page with about link, which will get about author content from created page (post) inside WordPress dashboard with name about. I’m using Magnific Popup plugin for poups. I have about.php which includes content of about page like this: <?php $pageid = 2; // 2 is the id of about page/post $about […]

Where are the contents of WP_Head

I’m building a theme based on underscores. In the header I’m finding some code for a margin-top but I can’t seem to find the source in order to get rid of it. I looked in functions hoping it was defined there, but I actually can’t find anything in the theme @media screen and (max-width: 782px) […]

How do I add a logo to my website?

I would like to know how to do add a logo to my website, before the site title. <html <?php language_attributes(); ?>> <head> <meta charset=”<?php bloginfo( ‘charset’ ); ?>” /> <meta name=”viewport” content=”width=device-width, initial-scale=1″> <link rel=”profile” href=”http://gmpg.org/xfn/11″ /> <link rel=”pingback” href=”<?php bloginfo( ‘pingback_url’ ); ?>” /> <?php /* Embeds HTML5shiv to support HTML5 elements in […]

Adding javascript to functions.php causes problems with my template

I want a “Read on” link that moves to another part of the page when clicked. I understand the HTML bit and I have even used some nice scrolling. It works. But when implemented breaks part of my theme. The slider image is gone and the H1 text is all bunched up to the left. […]

add_action to wp_head is added, but not called

I’m using the CiviCRM plugin for WordPress, and in the plugin’s main file, civicrm.php, it calls add_action() to add a function to wp_head() in order to merge CiviCRM’s header with my theme’s header: add_action( ‘wp_head’, array( $this, ‘wp_head’ ) ); The actual function within civicrm.php is found below: public function wp_head() { echo “calling wp_head”; […]

How to style injected code in header section?

Trying to add custom code to header section <head>..</head>of the blog by adding this code to child-theme functions.php // Add scripts to wp_head() function child_theme_head_script() { if ( is_singular( ‘article’ ) ) { $cjt = ”.'<meta name=”date” content=”‘ . get_the_date().'” />’ . ”; $ct = ”.'<meta name=”title” content=”‘ . get_the_title().'” />’ . ”; } echo […]

Grab ID from post from plugin and use it to create an object

I want to create an object and set ID for this object like $p = new Product(87); I have this code within a plugin and I want to grab the ID of the custom post being showed: function getPostId(){ global $wp_query; global $pid; $pid = $wp_query->post->ID; echo ‘pid=’ . $pid; //returns 87 } add_action(‘wp_head’,’getPostId’); //I […]

Include HTML (Bootstrap Modal Box) with a plugin into my header

I want to include some HTML, spezific a bootstrap modal box. This is my function with the HTML part: public function dmd_fav_modal_box() { $content = ‘<div class=”modal fade” id=”dmd_favorite_modal” tabindex=”-1″ role=”dialog” aria-labelledby=”dmd_favorite_modalLabel”> <div class=”modal-dialog” role=”document”> <div class=”modal-content”> <div class=”modal-header”> <button type=”button” class=”close” data-dismiss=”modal” aria-label=”Close”><span aria-hidden=”true”>&times;</span></button> </div> <div class=”modal-body”> <p>Test</p> </div> <!–div class=”modal-footer”> <button type=”button” class=”btn […]

Add inline style to pages where shortcode was used

I am trying to add a style to the header, using this method the style only loads on single posts but if I use a shortcode to load the post content that style does not load in the header: add_action( ‘wp_head’, ‘output_styles’) function output_styles($base_ID){ $global post; echo ‘<style type=”text/css”>’. get_post_meta($post->ID, ‘append_css’) .'</style>’; } in my […]