Are you the publisher? Claim or contact us about this channel


Embed this content in your HTML

Search

Report adult content:

click to rate:

Account: (login)

More Channels


Channel Catalog


Channel Description:

WordPress › Support

older | 1 | .... | 321 | 322 | (Page 323) | 324 | 325 | .... | 413 | newer

    0 0

    add_theme_support( 'custom-background' );
    
    add_action( 'customize_register', 'custom_background_size' );
    function custom_background_size( $wp_customize ) {
    
        $wp_customize->add_setting( 'default-size', array(
                'default' => 'inherit',
            ) );
    
        $wp_customize->add_control( 'default-size', array(
                'label'      => 'Background Image Size',
                'section'    => 'background_image',
                'settings'   => 'default-size',
                'priority'   => 200,
                'type' => 'radio',
                'choices' => array(
                    'cover' => 'Cover',
                    'contain' => 'Contain',
                    'inherit' => 'Inherit',
                )
            ));
    }
    add_action( 'wp_head', 'custom_background_size_css', 999 );
    function custom_background_size_css() {
    
        $background_size = get_theme_mod( 'default-size', 'inherit' );
    
        echo '<style type="text/css"> body.custom-background { background-size:'.$background_size.'; } </style>';
    
    }

    This is code i'm using that add custom background image to customizer (from codex) and additional size attribute.

    Now i want it to hide along other controls when image is not specified but can't find active_callback name for it.

    Also i would like to move whole custom background section to panel. Tried :

    add_theme_support( 'custom-background', $defaults );
    
    $defaults = array(
    	'panel' => 'theme_settings'
    );

    but that's not working. Any idea how can i get these 2 things work ?
    Thanks

    @up
    One more thing. How can i add section icons like in first screenshot here ?


    0 0

    I'm working with an XML Feed of which I want to create "fake" pages for so I need multiple endpoints. The XML Feed grabs categories and products based on a passed ID. I can pass that ID via query string but what I want to do is further convert that ID to the string value returned. So before WordPress prints the URL I need go get ahead of it, grab the query string ID, hit the API to get the category ( or product ) and replace the query string with a pretty permalink of the category name.

    I can create my products endpoint, show the categories from the XML feed, I'm linking them to look something like this:

    /products/category/?cat_id=2

    So in theory, when on a page like this I need to replace ?cat_id=2 with the actual category name given to me by my API:

    /products/category/category-name/

    Here's how I'm creating the endpoint for my products page:

    /** Register Query Vars **/
    function theme_custom_query_vars( $vars ){
        $vars[] = 'products';
        return $vars;
    }
    add_filter( 'query_vars', 'theme_custom_query_vars' );
    
    /** Register Endpoint **/
    function theme_register_endpoints() {
        add_rewrite_rule( '^products/?', 'index.php?products=products', 'top' );
    }
    add_action( 'init', 'theme_register_endpoints' );

    Another option I have is to actually create the pages:

    • Products
      • Category
        • Product

    And then assign them page templates. This would get around making multiple endpoints but I still have the core issue which is grabbing the query string, processing it, and returning it back into the permalink as a pretty category or product name.

    I've been searching online for a bit on this but there's so many rewrite functions and hooks I'm not sure which is the right ones to use, I feel like I'm just throwing spaghetti code against the wall to see what sticks.

    Template tags was an option at a certain point but it sounds like I would need to use the post_link filter which I cannot do since this deals with pages and the page_link filter doesn't provide me with a query string ( to replace the template tag ) but an actual URL.

    Again, this is an issue I've run into before - I have an endpoint and I need to process query strings and return pretty strings to the permalink replacing the actual query string. Any help, tips, suggestions, solutions, guidance, alternatives, etc. would be fantastic.

    http://wordpress.stackexchange.com/questions/209006/enpoint-not-found-in-rewrite-tag-permalink


    0 0

    I am trying to echo all author posts for each user as URLs with user_id as the author id in a custom column within the User List table (User.php)... not sure what is wrong.. Thanks!

    function new_modify_user_table_send_inv( $column ) {
        $column['send_inventory'] = 'Email Inventory';
        return $column;
    }
    add_filter( 'manage_users_columns', 'new_modify_user_table_send_inv' );
    
    function new_modify_user_table_row_send_inv($custom_column, $column_name, $user_id ) {
    	if ($column_name=='send_inventory') {
    			$posts = get_posts(array('author'=>$user_id));
    			$custom_column = array();
    			if(isset($posts) && !empty($posts))
    				foreach($posts as $post){
    					$custom_column[] = "<li>".$post->post_title."</li>";
    				}
    			$custom_column = implode("\n",$custom_column);
    	}
    	return $custom_column;
    }
    add_filter( 'manage_users_custom_column', 'new_modify_user_table_row_send_inv', 10, 3 );

    0 0

    Hello - I'm looking for a way to reorder RSS items into a (separate) custom feed. This is for a daily email newsletter (RSS driven) where we need to be able to move the positioning of the stories without changing their publish dates on the actual site.

    I figured there would be a plugin that would allow me to drag / drop Post order to build a custom feed but I've had no luck in my searches.

    It doesn't have to be a WordPress tool either - it could be something third party that ingests the feed, manipulated it and spits out a new feed (something like MailChimp's chimpfeedr.com tool).

    Any suggestions would be much appreciated!


    0 0

    We are using a custom login page that has form to reset your password (enter your username or email and you receive and email with a link to reset). My question is how to send the user to a custom URL (a page that says "Please check your email")? Right now it just takes you to the same page you're on, with no notification that your request has been submitted.

    <form name="lostpasswordform" id="lostpasswordform" action="<?php echo esc_url( network_site_url( 'wp-login.php?action=lostpassword', 'login_post' ) ); ?>" method="post">


    0 0

    Hi all currently I get data displaying the users posts on the users admin table for each user row in a custom column. I'd like to be able to have a button instead of the row content to be able to click and send an email with the ouput of my user posts function.. I know wp_mail is the route..

    Thanks! --- Function below

    function new_modify_user_table_row_send_inv($value='', $column_name, $user_id ) {
        if ($column_name =='send_inventory') {
    			$posts = get_posts(array('author' => $user_id));
    			$tmpdata = array();
    			if(isset($posts) && !empty($posts))
    				foreach($posts as $post){
    					$tmpdata[] = "<li>".$post->post_title."</li>"."TEST";
    				}
            		$varnew = implode("\n",$tmpdata);
    	}
       return $varnew;
    }
    add_filter( 'manage_users_custom_column', 'new_modify_user_table_row_send_inv', 90, 3 );

    0 0

    hii

    i am a newbie in plugin development iam working on the_title() filter. i do not want to change al the title of the posts. i want to change the particular title of the post. how can i do this. your help will be highly obliged.


    0 0

    I am using a theme that offers a top menu that appears above the full-width graphical banner at the top of the page. On the static home page, I want one additional menu to appear, but only on the home page, not other pages or single-post pages.

    the following path contains a file named theme-functions.php that appears to contain the code that initiates the notion of having a top menu:

    wp-content/themes/sahifa/framework/functions/theme-functions.php

    /*-----------------------------------------------------------------------------------*/
    # Setup Theme
    /*-----------------------------------------------------------------------------------*/
    add_action( 'after_setup_theme', 'tie_setup' );
    function tie_setup() {
    
    	add_theme_support( 'automatic-feed-links' );
    	add_theme_support( 'woocommerce' );
    	add_theme_support( 'title-tag' );
    	add_theme_support( 'html5', array( 'comment-list', 'comment-form', 'search-form', 'gallery', 'caption' ) );
    	add_theme_support( 'post-thumbnails' );
    
    	add_filter( 'enable_post_format_ui', '__return_false' );
    
    	load_theme_textdomain( 'tie', get_template_directory() . '/languages' );
    
    	register_nav_menus( array(
    		'top-menu'	=> __( 'Top Menu Navigation', 'tie' ),
    		'primary'	=> __( 'Primary Navigation', 'tie' )
    	) );
    }

    The following code makes the additional menu item appear on the home page, but the item shows up above the other "top menu" menu items:

    <?php if ( is_front_page() ) { ?>
    <li id="menu-item-1264" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-1264"><a href="#guest-writing">SUBMIT CONTENT</a></li>
    <?php } ?>

    How do I get the one additional menu item to visually appear on the home page like it's one of the other top menu items that appear on all pages?


    0 0

    Hi,

    I have an article that was multiple pages (let's say 4). Currently, the pagination allows the user to navigate between the pages in the article, which is all fine and dandy but i'm looking to alter the way the pagination works so that it no-longer displays the option to view the final page. This being that the page still exists, but the user can only view the first 3, and the only way to view the fourth page is via a direct link. Is this possible, if so, how would i go about implementing it?

    Thanks,
    Chris


    0 0

    Please I added the code below to my functions.php file so i can display my blog's 12 most recent registered users in a table, you can view the demo at https://nairalake.com/test-recent-members-display/
    but the problem I'm having is how to make the date display like 20/11/2015 instead of the default format which is 2015-11-20 22:22:08

    Please I only want to show the date without time.

    function wpb_recently_registered_users() {
    
    global $wpdb;
    
    $recentusers = '<ul class="recently-user"><table width="500px" border="2">';
    
    $usernames = $wpdb->get_results("SELECT user_nicename, user_registered, user_url, user_email FROM $wpdb->users ORDER BY ID DESC LIMIT 12");
    
    foreach ($usernames as $username) {
    
    if (!$username->user_url) :
    
    $recentusers .= '<tr><td width="250px"><b>' .$username->user_nicename." </b></td><td><b> ".$username->user_registered."</b></td></tr>";
    
    else :
    
    $recentusers .= '<li>' .$username->user_nicename."</li>";
    
    endif;
    }
    $recentusers .= '</table></ul>';
    
    return $recentusers;
    }

    0 0

    How can you restrict the posts displayed by user_id using this logic?

    <?php
    define('WP_USE_THEMES', false);
    require('./wp-blog-header.php');
    
    $num = $_GET["numberposts"] ?: '10';
    $cat = $_GET["catid"];
    $postID = $_GET["postid"];
    $type = $_GET["type"];
    //$author = $_GET["author_id"]
    
    switch ($type){
       case "singlePost":
          $posts = get_posts('p='.$postID.'&numberposts=1');
    	  //$posts = get_posts(array('author' => 2);
    
          break;
       case "catFeed":
          $posts = get_posts('category='.$cat.'&numberposts='.$num.'&order=ASC');
    	  //$posts = get_posts(array('author' => 2));
          break;
       default:
          $posts = get_posts('numberposts='.$num.'&order=ASC');
    	  //$posts = get_posts(array('author' => 2));
    	  $posts = get_posts('numberposts='.$num.'&order=ASC');
    }
    ?>
    <xml>
    <items>
          <?php if($type == "catFeed"){ ?>
             <catname><?php echo get_cat_name($cat); ?></catname>
             <catdescription><?php echo category_description($cat); ?></catdescription>
          <?php } ?>
          <?php foreach ($posts as $post) : start_wp(); ?>
             <item>
                <id><?php the_id();?></id>
                <title><![CDATA[<?php the_title();?>]]></title>
                <link><?php the_permalink_rss() ?></link>
                <author><?php the_author();?></author>
    
                <pubDate><?php the_date();?></pubDate>
                <teaser><![CDATA[<?php the_excerpt();?>]]></teaser>
                <?php if($type == "singlePost"){ ?>
                   <content><![CDATA[<?php the_content();?>]]></content>
                <?php } ?>
             </item>
          <?php endforeach; ?>
       </items>
    </xml>

    0 0

    Hi,

    When I uninstall my plugin I want to remove all events (custom post type) and event postmeta from database. I use this code in uninstall.php for that:

    // Delete events + metadata
    global $wpdb;
    $wpdb->query( "DELETE FROM {$wpdb->posts} WHERE post_type IN ( 'event' );" );
    $wpdb->query( "DELETE meta FROM {$wpdb->postmeta} meta LEFT JOIN {$wpdb->posts} posts ON posts.ID = meta.post_id WHERE posts.ID IS NULL;" );

    Taken from Woocommerce, and it works like a charm.
    My question: the second query removes the event postmeta, but I don't understand how it's part of the first query? I mean, why does it only remove postmeta from events and not from all posts?

    Guido


    0 0

    Hi,
    I need to modify/overwrite couple of links in my wp theme. The actual theme works perfectly fine, but I want to overwrite one of the page’s links (and direct it to different page) and I can’t do it in a dashboard. If I open the the site in Dreamweaver I can see all the links in the “live” view, but I can't modify it. Same thing in a web browser’s source code page, I can modify the link but it’s not permanent. I understand how wp assembles pages from multiple php files, but non of the php file contain the link source code. Anyway, is that even possible? Thank you so much!

    Jennifer!


    0 0

    I have a number of word press sites and use Git to control the sauce code for them, each site is an independent repo.

    I've been looking for a way to register a callback run after every plug-in and core update to commit these changes into the repository. However I have not fund a clear answer on how to do so. It would neet to run:

    git add .
    git commit -a -m 'auto update info'

    As it is with having to remember to do this manually, I keep clobbering updated systems whenever I commit on my development system and push it to the live server.


    0 0

    It seems that bulk_edit_posts calls the wp_insert_post (in turn calling any save_post callback before the Post Format is updated. Is this really by design or is it a bug? It seems this makes it impossible to utilize get_post_format from within a save_post callback because it won't work when using Bulk Edit as it will return the old post format. Maybe my logic is wrong?

    Edit: Adding reference. bulk_edit_posts. See lines 559 and 568/569


    0 0

    How can I add custom image download button for WordPress?

    I mean when we click on download button, instantly starting image downloading without any pop up or warning.

    Demo Site : http://www.teluguone.com/photos/single/allu-arjun-new-look-photos-2-11079-275568.html
    (See at bottom of image. red "download" button)
    Screenshot: http://i.imgur.com/kiKk8cm.png

    .


    0 0

    Hi,

    I'd like to create a single taxonomy to connect and display as groups on frontend wp posts, bbpress topics, woocommerce products, wp job manager jobs, etc.

    Tips appreciated!
    Thanks


    0 0

    Hi,

    I've developed C# windows apps previously, but I'm really new to Wordpress and web development so sorry in advance if my question is a silly / simple one!

    Is there a way to show / hide content on a wordpress page depending on an ID?

    What I am trying to implement is:

    We email our user base a link to wordpress site which has their own unique id.

    When the user clicks the link, they will come to our site and we will be able to check the id. We will check this id in our database and then depending on the setting in the database we can show or hide part of our webpage.

    Does this sound like a sensible idea?

    Thanks


    0 0

    I've made my plugin translation ready and have four translations provided by users, but they don't appear to be picking up strings in JavaScript. Is there a best practice to enable translators to translate WordPress JavaScript elements?

    Thanks!

    --David


    0 0

    Hello,
    I have a custom page that is located on the same url adress as another script.
    For example my page is mysite.com/email-sender this is wordpress sales page for the services but on the same root on the hosting /email-sender there is another CMS. I would like to open the wordpress page but cant change the other script path.
    I would be very happy if anyone help me:)
    Ttanks


older | 1 | .... | 321 | 322 | (Page 323) | 324 | 325 | .... | 413 | newer