wordpress-theming

How can I retrieve a list of a Wordpress page's sibling pages?

怎甘沉沦 提交于 2019-12-05 14:23:21
问题 I am trying to create a list of sibling pages (not posts) in WordPress to populate a page's sidebar. The code I've written successfully returns a page's parent's title. <?php $parent_title = get_the_title($post->post_parent); echo $parent_title; ?> As I understand it, you need a page's id (rather than title) to retrieve a page's siblings (via wp_list_pages). How can I get the page's parent's id? Alternate approaches are welcome. The goal is to list a page's siblings, not necessarily just

Wordpress Theming: add custom scripts and jquery the correct way

£可爱£侵袭症+ 提交于 2019-12-05 13:32:30
Just took over a wordpress project. The former developers screwed up the theming so it prevents my ajax forms (gravityform) from working correctly. Proplem is the way they add jquery and custom js in header.php: <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/jquery.easing.1.3.js"></script> <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/slides.min.jquery.js"></script> <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/script.js"></script> <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/tabs

How to display the featured image of a page in the page itself automatically in WordPress? [closed]

血红的双手。 提交于 2019-12-05 12:37:56
Closed. This question is off-topic . It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . Please i need your help with the following. The features images that i am setting for my pages are not getting displayed in the pages themselves. Is there any plugin or something i can do in order to let those featured images that i am setting for posts and pages to get displayed inside the corresponding entry? Any suggestions are greatly appreciated! Put: <?php if ( has_post_thumbnail() ) { the_post_thumbnail()

How to hide a template in Wordpress? [closed]

吃可爱长大的小学妹 提交于 2019-12-05 10:29:46
Is there a way to hide a template file in admin? For example I have a template that should only be available if a specific plugin is installed, and I already know how to check if plugin is active. But how do I hide the template? For example I want to hide "Blogger Redirection"-template bellow: I have found several links, but all of the solutions seems deprecated. EDIT: If anyone is interested in how I check if pluin is active I do it with the following function: function isPluginActive($plugin){ if ( in_array( $plugin, apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {

Adding jquery and custom scripts to a Wordpress theme

走远了吗. 提交于 2019-12-05 09:59:45
Doing some searching through Google, I came across the same bit of code over and over for adding jQuery to a from-scratch Wordpress theme. if (!is_admin()) add_action("wp_enqueue_scripts", "my_jquery_enqueue", 11); function my_jquery_enqueue() { wp_deregister_script('jquery'); wp_register_script('jquery', "http" . ($_SERVER['SERVER_PORT'] == 443 ? "s" : "") . "://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js", false, null); wp_enqueue_script('jquery'); wp_enqueue_script('my_script', get_bloginfo('template_url') . '/js/theme.js', array('jquery'), '1.0', true); } I've added this code

How to include jQuery in a WordPress theme?

假如想象 提交于 2019-12-05 09:53:29
I am pretty new to WordPress and I am figuring out how to include jQuery into a theme. I create the following function into functions.php theme: function load_java_scripts() { // Load FlexSlider JavaScript that handle the SlideShow: wp_enqueue_script('jQuery-js', 'http://code.jquery.com/jquery.js', array(), '1.0', true); } add_action('wp_enqueue_scripts', 'load_java_scripts'); So I think that I can add it as some other JavaScript or CSS local resources but I am not sure about this method because in this case the jquery.js is not a local resource but is an online resource (is it the same thing?

Keep finding inject gibberish PHP in my Wordpress theme files

牧云@^-^@ 提交于 2019-12-05 08:02:30
问题 I built a custom theme for a client's site and it keeps getting hacked, I guess. What I'm finding is a bunch of gibberish code at the top of each theme file and plugins as well. It's all super-compressed and not very easy to read, but it just looks like a bunch of numbers. It's not outputting anything on the site itself. The only reason I know it's happening is because the addition of the code to the plugins breaks the plugin and WP auto-disables it. This has happened about 5 or 6 times.

How to force wp_enqueue_style to display CSS at the very bottom of the head tag to override all CSS rules?

人盡茶涼 提交于 2019-12-05 05:16:48
I am currently studying on how to create Wordpress administration templates via plug-ins, and according to the Wordpress Wiki you can use hooks such as admin_head , wp_admin_css , and/or login_head to manually echo your link html tag: echo "<link rel="stylesheet" type="text/css" href="' . get_option('siteurl') . '/wp-content/plugins/blue-steel/login.css" />'."\n"; The example obviously is A Bad Thing because of the way the link tag is hardcoded inside php logic. The ideal is to use wp_enqueue_style() to insert CSS. However, it has it's own idea of WHEN the CSS is inserted, and only reacts to

wp_enqueue_style and rel other than stylesheet?

 ̄綄美尐妖づ 提交于 2019-12-05 02:47:35
I create (or better try) to create my first WordPress theme with Less. What I do is to use a script like that into my functions.php wp_register_style('screen_css', get_bloginfo('template_url') . '/css/screen.less', array(), false, 'screen'); wp_enqueue_style('screen_css'); and the result is that: <link rel='stylesheet' id='stigma_screen-css' href='http://www.stigmahost.dch/wp-content/themes/stigmahost/css/screen.less?ver=1.0' type='text/css' media='screen' /> The question is, can I change somehow the rel="stylesheet" when I using the wp_register_style() function ? While neither function will

how to show user's username when logged into a wordpress site?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-05 02:24:25
问题 I would like to have the header of my site reading "Logged in as " when a user is logged into my wordpress site. I dont know how to echo the username of the current user, heres the code I'm got... <?php if ( is_user_logged_in() ) { echo '<ul id="mem" class="clearfix"> <li><a href="#">Logged in as Username</a></li> <li><a href="#">Logout</a></li> </ul>'; } else { echo '<ul id="mem" class="clearfix"> <li><a href="#">Register</a></li> <li><a href="#">Login</a></li> </ul>'; } ?> and I'd like to