Forum Replies Created

Viewing 15 replies - 61 through 75 (of 681 total)
  • You don’t need a template to display different content in sidebars.

    You need widget logic. It adds every single registered widget a section where you can add WP conditionals for displaying the widget.

    Assuming you have a widget that you want everywhere but author pages, you add this condtional:

    !is_author()

    If you want a widget that should only display on pages with ids 214 and 328:

    is_page(array(214,328))

    Author with ids 5 or 8, nicename of deputy or nickname of shot the Sheriff:

    is_author(array(5,8,'deputy','shot the Sheriff'))

    And so on…

    You only need to create author templates in one of these cases:

    1. You want to replace the default display of all authors pages (create a template named “author.php”).
    2. You want to replace the default display of a particular author page (create a template named “author-{nicename}.php” or author-{ID}.php).

    The template precedence for authors is:
    author-{nicename}.php > author-{ID}.php > author.php > archive.php > index.php

    This basically means that if the theme does not provide an author.php, archive.php will be used instead and if that does not exist either, index.php will handle the request.

    More on WP template hierarchy here.

    My question is: why would you need a static page with an author’s posts when you already have the default WP author pages?

    You’re welcome. Don’t forget to mark as resolved if it works.

    I just inspected your website and and ran into the following error:

    Failed to load resource: the server responded with a status of 404 (Not Found):
    https://mcasien.com/wp-content/themes/Customizer-child/www/wp/wp-content/themes/customizr/style.css

    That’s why your css doesn’t apply. Remove line 13 from your child theme’s style.css:

    @import url('www/wp/wp-content/themes/customizr/style.css');

    Apart from other themes, Customizr already loads the parent theme css, so you don’t need to load it yourself. Besides, the proper path for that would be:

    @import url('../customizr/style.css');

    functions.php should have

    <?php

    on first line and the actual code should begin from second line. This is true for any “pure” php file. Also, in most cases, it’s very important that before the starting “<” there is no character, no empty space, tab, or empty line. That might have caused the WSOD.

    Try again but this time change line 5 from that code with

    return $html.'<hr class="featurette-divider">';

    I might be wrong, but current_filter() might not be callable in your functions.php and that might also cause a WSOD.

    1. Set your front page to display latest posts.
    2. Save this as blog.php and put it in your child theme folder:

    <?php
    
    /*
    Template Name: Blog
    */
    
    add_action('__before_loop', 'tc_blog_template_query');
    add_action('__after_loop', 'wp_reset_query', 9999, 0);
    get_template_part('custom-page');
    
    function tc_blog_template_query() {
    	$paged = (get_query_var('paged') ? get_query_var('paged') : (get_query_var('page') ? get_query_var('page') : 1));
    	query_posts('is_posts_page=true&paged='.$paged);
    	}

    3. Edit your blog page (the static one, other than homepage) and select “Blog” as template from Page Attributes Box.

    Note: this solution loads custom-page.php (generic boilerplate for custom page templates) and applies some actions to it on the fly. It assumes it has not been modified. I specifically wanted to load the template dynamically to ensure that you don’t lose any updates or additions to this template in future versions of the theme.

    Michael, from what you wrote I understand that your page disappears when you click on blank space of the page. I have tried to click everywhere around your page and between page elements but I wasn’t able to reproduce your problem.

    If this only occurs on one specific page, please provide a link to it. Also, keep in mind that it might be caused by a faulty plugin. Try disabling your plugins first, force a page refresh (Ctrl+F5 / Shift+F5) and see if your problem still exists.

    Get back here with more info if the problem persists, with more details that will help us reproduce it, so we can track it down.

    Please add this fix to the code above, in the same media query (so it needs to be above the last “}”:

    .page-template-full-width-php {overflow-x: hidden;}

    At some widths a false horizontal bar appears (there’s only a small empty space to the right) and the line above eliminates the horizontal scroll.

    And yes, I left you with a 100% layout. I thought it would be fair to allow you to handle the padding of your contents yourself, not set one myself (for example you might want to have elements that you want to glue to one side or the other)…

    Also, note that my code only applies to widths above 768px. There are currently some minor CSS bugs that create a false horizontal bar at small widths too, but I’d stay away from those as I’m pretty sure they will get fixed at some point from the parent theme. If you fix them now you might not come up with a cross-browser solution.

    Well, the plugin/function I set out to write has already been written, quite neatly, I might add after looking a bit over its code. I highly recommend: Edit Author Slug Plugin.

    It allows you to change your author slug to sanitized versions of username, nickname, firstname, lastname or even a custom string that has nothing to do with any of the above. Also, you can change the $author_base rewrite from author to anything else.

    For example, my username is not acub on websiter.ro: https://websiter.ro/coder/acub/

    It is a known WP “security breach”. However, it only gives hackers the username, and protecting your site from brute force attacks is at hand. Actually, brute force attacks on user accounts rarely happen on WordPress. The are other easier ways to breach a WP website, such as jQuery redirecting iframe backdoors allowed by poorly written or malicious plugins.

    And yes, the quick-fix for this is to manually edit your user’s user_nicename in the database. Be warned, you should change it to a sanitized string (A-Z,a-z,0-9,-,_). This is also why user_nicename is not directly editable. If it was, a lot of un-savvy WP users would break their author pages by inputting unsafe strings for use in that field.

    I will look further into this to see if I can create a function that uses the nicknames for author links and maybe also sanitize nicknames upon user profile save. I’ll keep you posted about it.

    There is no support for border-image (and it’s family: source|slice|width|outset) in IE 10 and lower, as well as in Opera. I was assuming you needed a cross-browser solution.
    Scroll down to browser support.

    We’re talking about over 40% of internet users here.

    Currently, in CSS, you cannot specify an image as border. Even if you could, you’d have positioning problems. Your only practical solution is to create some sort of frame for your featured pages block, with a solid background, if you want the rest of the page to have an image/pattern background. I did something similar on https://websiter.ro.

    The short answer is: no.

    The zoom effect is achieved by scaling some elements with a very thick border and a large border-radius, which are positioned above the images.

    Unfortunately, border-color does not allow a value of transparent. Yet. So, basically, you need to match the color of .round-div border with the color of the background.

    1. Create a copy of custom-page.php from Customizr in your child theme and name it full-width.php

    2. On line 5 of full-width.php, change the template name from Custom Page Example to Full Width Layout. Save and upload.

    3. Add this to your CSS (either the theme settings Custom CSS pannel or style.css of your child theme):

    @media (min-width: 768px) {
    .page-template-full-width-php #main-wrapper {
    	width: 100%;
    	overflow-x: hidden;
    	}
    .page-template-full-width-php #main-wrapper .breadcrumbs {
    	margin-left: 10px;
    	}
    .page-template-full-width-php .container {
    	width: 100%;
    	}
    .page-template-full-width-php #content {
    	width: 98%;
    	margin: 0 auto;
    	display: inline-block;
    	}
    .page-template-full-width-php .row {
    	margin-left: 0;
    	margin-right: -30px;
    	}
    }

    4. Go in the edit screen (backend) of any page you want this template applied to and select the “Full Width Layout” template from the list, in Page Attributes Box.

    That’s it. This only works with no sidebar (full width) layout. If you want a sidebar in this layout you will need to create a space in your layout for it and call it using a shortcode for dynamic_sidebar().

    If you create a child theme, every time WP needs a theme file, it looks for it in the child theme. If it’s not there, it loads it from parent.
    So all you need is copy the file you want to modify in your child theme (keeping the same folder structure) and mod it.
    If the file you have modified gets upgraded in future versions of the theme, WP will still load your child theme version, so you will basically lose all upgrades applied to that particular file.
    But you can always take the upgraded file from parent, reapply your mods and replace the one in your child theme.

Viewing 15 replies - 61 through 75 (of 681 total)