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 | .... | 395 | 396 | (Page 397) | 398 | 399 | .... | 413 | newer

    0 0

    /wp-json/wp/v2/posts this gives me 10 lates posts, what should the request url look like to get 10 more and more posts on the each button click,


    0 0

    Is there any hook (or method) to modify a content of comment meta box in post.php of admin area?
    (for example, adding a date to "td.column-author" or removing some unnecessary element)

    or

    Do I have to make my own meta box to create original view of comment list?

    Since I cannot find any proper hook which can modify html of comment list in admin panel,
    I've been trying what I can by using Jquery though...


    0 0

    Hi.

    I'm adding some meta_boxes:
    add_meta_box('ss_product','Simple Sales fields','simple_sales_show_boxes', 'ss_product', 'normal', 'high');

    This is my callback simple_sales_show_boxes

    function simple_sales_show_boxes(){
      global $post;
      $ID=$post->ID;
      echo '<input type="hidden" name="simple_sales_meta_boxes_nonce" value="', wp_create_nonce(basename(__FILE__)), '" />';
      $box_fields=
        array(
          array(
            'name' => 'price',
            'desc' => 'Price of Item',
            'id' => 'product_price',
            'type' => 'text',
            'value' => get_post_meta($ID,'product_price',true)
          ),
          array(
            'name' => 'ordered',
            'desc' => 'Items ordered',
            'id' => 'ordered',
            'type' => 'number',
            'value' => get_post_meta($ID,'ordered',true)
          ),
          array(
            'name' => 'stock',
            'desc' => 'Stock remaining',
            'id' => 'stock',
            'type' => 'number',
            'value' => get_post_meta($ID,'ordered',true)
          )
      );
      foreach($box_fields as $field){
        echo '<tr>
              <div style="width:20%"><label for="'. $field['id']. '">'. $field['desc'].'</div>';
        switch($field['type']){
          case 'text':
            echo '<input type="text" name="'. $field['id']. '" id="'. $field['id']. '" value="'.$field['value']. '"
              size="30" style="width:50%" /><br />';
            break;
          case 'hidden':
            echo "
            <input id='".$field['id']."' type='hidden' name='".$field['id']."' value='".$field['value']."'>";
          break;
          case 'photos':
            echo '<input id="upload_image" type="text" size="36" name="upload_image" value="" />
            <input id="upload_image_button" type="button" value="Upload Image" />';
          break;
          case 'number':
            echo '<input id="'.$field['id'].'" type="text" size="36" name="upload_image" value=""
            onkeypress="return (event.charCode >= 48 && event.charCode <= 57)||event.charCode ==46||event.charCode==45" /><br />';
          break;
        }
        echo '</label>';
      }
    }

    I then use the save_post add_action with the callback simple_sales_save_products

    add_action('save_post','simple_sales_save_products');
    
    function simple_sales_save_products(){
      if(!check_nonces_an_all('simple_sales_meta_boxes_nonce','ss_product')){
        return;
      }
      global $post;
      update_post_meta($post->ID, "product_price", $_POST["price"]);
      update_post_meta($post->ID, "stock", $_POST["stock"]);
      update_post_meta($post->ID, "ordered", $_POST["ordered"]);
    }

    However, when the $_POST array is checked it's empty.

    $_POST = array (
    );

    And the database table post_meta has NULL values in the meta_value fields corresponding to the meta_keys 'product_price', 'ordered' and 'stock'.

    What am I doing wrong?


    0 0

    Hello all -
    I have a blog for my podcast and would like to have two or more different author types. For example, I would like to have the post list all of the people who spoke on the podcast (SPEAKERS), as well as the person who wrote the show notes (WRITER). In one place I would like to have "written by: writer name." In another place, I'd like to have, "participants on episode: list of speaker names." Maybe with their pictures and social media links.

    Ideally, the names would also be clickable and show a list of all the other posts that person was involved in. Is there any easy way to accomplish this?

    The co-authors plugin offers a very similar functionality, but doesn't allow me to differentiate between speakers and writers.

    Thanks!


    0 0

    Hi -

    I have a somewhat unique requirement and hours of searching have not provided a solution, so I'm hoping that some of you have some ideas.

    I would like to be able to automate the process of adding featured images to posts that are published without images. Most specifically, I would like to be able to automatically add an image from the media library that matches the keywords or tags of the post, with a randomizer feature that allows for variety. (The images will all have been tagged.)

    This is easier to explain with an example: Let's say that I have a website about dogs. In the media library, I have included a collection of 40 photographs of golden retrievers, with all of the images tagged to include the breed of the dog, as well as large collections of images for other breeds.

    Now let's say I publish a post about golden retrievers. I would like WordPress to see that the post includes "golden retriever" in the post title, text and/or tag, then select one of the 40 images that have been tagged "golden retriever." The image selected can be somewhat random, just as long as it is relevant (i.e. the tag of the image needs to match something in the post) and there isn't too much redundancy (i.e. the image that is selected should not have been used in other recent posts about golden retrievers.)

    Is this possible? There are a variety of plugins that will add a default image for a given category, etc. but that doesn't provide the variety that I am looking for. There are also plugins that will create images, but I need to use photographs, not graphics.

    Any ideas for this are appreciated. Thanks in advance.


    0 0

    Currently I have this code

    $user = get_userdata($voucher_buyer_id);
    		$to = $user->user_email;
    		$from_mail = couponxl_get_option( 'email_sender' );
    	    $from_name = couponxl_get_option( 'name_sender' );
    		$headers[] = "From: ".$from_name." <".$from_mail.">";

    which auto-sends an email to the current logged user with purchase details.
    how can I BCC the same email to the post author?

    Thanks a lot


    0 0

    Hi everyone,
    I've create a plugin ( https://it.wordpress.org/plugins/annuncifunebri-onoranza/ ) that inserts into a page (that contains a placeholder) content taken from a call to the external site annuncifunebri.it .
    It works, but the problem is that the pages are not indexed; it index only the page created in wordpress (that contains the placeholder).
    An example:
    url page wp: page1
    url pages created dynamically: page1/a1/b1, page1/a2/b2, ...
    In google analytics I see that this pages compare, but no one have a result in the search engine.
    I've also create a sitemap that is sent to google, but no one page is indexed.
    What can i do?

    PS. Sorry for my english


    0 0

    how to write the output of this function in field 'tags' on post-edit the dasboard the worpress?

    $input = array("neo", "Morpheus", "Trinity", "Cypher", "Tank");
    $rand_keys = array_rand($input, 2);
    $mixnames = $input[$rand_keys[1]];

    Thanks to all.


    0 0

    The lack of a medium crop option has been an annoyance of mine for a long time.

    I currently use this in functions.php to force a crop.

    if ( get_option( "medium_crop") !== false ) {
        update_option("medium_crop", "1");
    } else {
        add_option("medium_crop", "1");
    }

    It works, but in order to properly remove it you need to replace it with this:

    update_option("medium_crop", "0");

    I’m now attempting to create a better solution. Using add_settings_section and add_settings_field I’m adding a new “Crop images” section at the bottom of Settings > Media.

    The idea being there’s an option to put a check in the box if you want to crop the medium images. If you don’t want to crop them you uncheck the box.

    This code is working to create the new section and the checkbox plus label.

    function crop_settings_api_init() {
    	// Add the section to media settings
    	add_settings_section(
    		'crop_settings_section',
    		'Crop images',
    		'crop_settings_callback_function',
    		'media'
    	);
    	// Add the fields to the new section
    	add_settings_field(
    		'medium_cropping',
    		'Medium size crop',
    		'crop_medium_callback_function',
    		'media',
    		'crop_settings_section'
    	);
    	register_setting( 'media', 'medium_cropping' );
    } // crop_settings_api_init()
    
    add_action( 'admin_init', 'crop_settings_api_init' );
    
    // Settings section callback function
    function crop_settings_callback_function() {
        echo '<p>Choose whether to also crop the medium size image</p>';
    }
    // Callback function for our medium crop setting
    function crop_medium_callback_function() {
    	echo '<input name="medium_crop" type="checkbox" id="medium_crop" value="1"';
        $mediumcrop = get_option( "medium_crop");
        if ( $mediumcrop == 1 ) {
            echo ' checked';
    	}
    	echo '/>';
    	echo '<label for="medium_crop">Crop medium to exact dimensions</label>';
    }

    However, how do I now merge this with the update_option code, so that once a user clicks “Save Changes” it updates the database?

    One important thing I should mention is, I think medium_crop is a standard option, so when I’ve added my settings field I’ve called it “medium_cropping”, I’m not sure about this but then I don’t know how to add the field without add_settings_field or how to use add_settings_field when the option already exists.

    Any help by anyone with knowledge of working with the Settings API and existing options would be much appreciated.


    0 0

    I'm working on a site in the Spanish language. In this site the Admins have uploaded images whose filenames contain Spanish characters -e.g. é, ó, ñ etc... And these images do not display on iPhone, iPad or Safari, so I need to do the following:

    a) Change all the filenames in the uploads folder to equivalents in the English language. E.g. Málaga -> Malaga
    b) Change the names of all URL's referencing the images in the Database to remove the foreign characters to correspond with the new filenames generated in step a.

    I've done step (a) with a UNIX script, but I'm stuck on step (b). In the Wordpress theme, the images are being generated by this line of PHP:

    $featured_image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_id()), 'single-post-thumbnail');

    So, does this mean that I should be changing all the GUID's which correspond to this SQL query?

    SELECT guid FROM mydb.xnpmc_posts WHERE post_type='attachment'

    or are the names of these images stored somewhere else in the database?

    I wrote a very small plugin that successfully changes all the names of the image files in that table using this code:

    $reader = Reader::createFromPath($plugin_dir . 'from-db-monday.csv');
    foreach ($reader as $index => $row) {
    	$wpdb->update(
    		$wpdb->posts,
    		array(
    		'guid' => $row[1]
    		),
    		array(
    		'ID' => $row[0]
    		)
    	);
    }

    but when I look at the HTML generated in Chrome Inspector, the names of the images still contain the foreign characters. It seems to me like the image names must be being read from some other part of the database, I just can't figure where it is!

    If anyone could help me with this I'd be very grateful.


    0 0

    Hi,
    I need help :)
    I can't code php and I'm building my site with code snippets and a lot of trial and error :P

    Let me explain what I'm trying to do:
    I have a post category called "Alben" (english: albums). This category has some child categories (like scenes or portraits). When I upload a new picture I create a post for it in one of the child categories.

    I created a special template for "Alben". When I click on "Alben" in my menue I get a page listing only the child category names, links and posts counts (no posts yet). Posts are only shown when I click on a child category name.

    I would now like to display the post thumbnail of the latest post in my child category on my special page under the child cat name.

    Is this possible?

    Here is the code I used to get and display the child categories:

    <?php
    	//for this category on an archive page, get the ID
    	$thisID = get_query_var('cat');
    
    	$get_children_cats = array(
    		'child_of' => $thisID //get children of this parent using the thisID variable from earlier
    	);
    
    	$child_cats = get_categories( $get_children_cats );//get children of this parent category
    
    	foreach( $child_cats as $child_cat ) {
    
    		//for each child category, get the ID
    		$childID = $child_cat->cat_ID;
    
    		//for each child category, give us the link and name and description
    
    		if ($counter == 2 || $counter == 5) {
    		echo '<div class="col"><h2><a href=" ' . get_category_link( $childID ) . ' ">' . $child_cat->name . '</a></h2><br/>';
    		echo '<div>' . $child_cat->category_description . '</div>';
    		echo '<div> Bilder: ' . $child_cat->category_count . '</div></div>';
    
    		}else{
    		echo '<div class="col-1"><h2><a href=" ' . get_category_link( $childID ) . ' ">' . $child_cat->name . '</a></h2><br/>';
    		echo '<div>' . $child_cat->category_description . '</div>';
    		echo '<div> Bilder: ' . $child_cat->category_count . '</div></div>';
    	}
    	$counter++;
    } //end of categories logic
    ?>

    I use two different divs because I display the child categories in 3 columns and the third div in each row has no margin-right. Just to explain the stuff up there a bit.

    The site is not online, so I can't give a link. But I have a picture :P
    Picture


    0 0

    One would expect that date_i18n() adjusts the time to the local time zone. However, the plugin programmer may have to initialize time zone as follows:

    date_default_timezone_set( get_option( 'timezone_string' ) );

    This is only required once, so the behaviour of a plugin may depend upon the fact that maybe another plugin has set it already.

    Would it not be better if date_i18n() should set the timezone on the first call so that simple plugin developers who are not aware of date_default_timezone_set() can rely on consistent behaviour of date_i18n()?


    0 0

    Downloaded "Sticky Menu (or Anything!)" plugin to keep my nav menu at the top when scrolling, however, as I scroll, only the link of the current page scrolls rather than the whole menu, also the background color is lost.

    How can i get the entire nav menu to stay at the top while scrolling and retain background color?

    heres the link to site I need help with http://tritechtactical.com/

    Thanks!


    0 0

    Hi
    I want to update automatically specific custom field to new specific value after 70 days from published post . ( i have 6000 posts in my blog )
    for example in beginning create post set "level_tutorial" = "advanced"
    i want set after 70 days "level_tutorial" to "Beginner"
    tanks!
    I know a little bit about ( update_post_meta ) but I do not know how to put in this case


    0 0

    Hello youthinkasido,

    I'm sorry but as you are using a commercial theme, you need to seek support from the theme's developer/vendor. We do not support commercial products here. You will need to ask this here - http://www.studiopress.com/forums/


    0 0

    I am looking for a php code which automatically creates a username for EACH visitor that views my site.

    After creating the user it should auto login.

    Username can be created from date, time, ip, or whatever

    Is there a simple way to do this, which enables me to autoregister visitors and allowing them to add email address if they find the site interesting?


    0 0

    As many people might know, when you password protect a page using the standard Wordpress functionality, it does protect it, but there is absolutely no feedback to the user if they input the wrong password.

    I grabbed some code I found and inserted it into my functions.php file. It works - see my site.

    This brings me to my current problem - I can't get any translatable strings to work in this piece of code. I have a multi-site setup in English and French, and all translations work correctly otherwise. I only have a vague grasp of php - not enough to diagnose the problem. Can anybody help?


    0 0

    Hi, I created two websites using wordpress (The other one is actually the clone of my other wordpress site) and used the same wordpress database(so 2 websites to one database). My problem now is that, the images is not synced to my clone site...is there any possible solution on this??


    0 0

    Hi all

    I was recently given a piece of code which should allow you to show the status of a stream but they have no wordpress specific knowledge. I was wondering how I can get this to show on a site.

    I was thinking as a widget just so you could display it on a sidebar where you'd want it but (as you can probably guess by me asking someone else for the code) I have no clue how to do that!

    Anywhoo, the code (and details) I was given is as follows:

    Well I dont know anything about wordpress... but for PHP (with Zend) this is what I do:

    $client = new Zend_Http_Client('https://www.googleapis.com/youtube/v3/search');
    $client->setParameterGet(array(
        'part' => 'snippet',
        'type' => 'video',
        'eventType' => 'live',
        'videoEmbeddable' => 'true',
        'channelId' => YOUR_CHANNEL_ID,
        'key' => YOUR_API_KEY,
    ));
    $feed = $client->request()->getBody();

    The above code gets a list of all currently live streams for your channel ID. Your channel ID btw is "UC8_cfxcDsKfx0Vys6vsr4Ug". If you simply want to know WHEN you are live, then this code will be all you need...
    The above feed results will be an array of videos, each video with it's own unique video ID.
    However, if you also want to display the details of your live stream (the title, description, number of viewers, etc), then you will need some additional code. I would then run a foreach loop in that case with the following code:

    $client = new Zend_Http_Client('https://www.googleapis.com/youtube/v3/videos');
    $client->setParameterGet(array(
        'part' => 'snippet,liveStreamingDetails,topicDetails',
        'id' => UNIQUE_VIDEO_ID,
        'key' => YOUR_API_KEY
    ));
    $video = $client->request()->getBody();

    That will get you the video details.


    0 0

    Is there a safe, always working way to convert an url to a path vice versa? I used to do it this way:

    <?php
    $url = str_replace( ABSPATH, site_url(), $path );
    .
    .
    $path = str_replace( site_url(), ABSPATH, $url );
    ?>

    but it looks like this does not always work correctly.
    I only need locations inside .../wp-content/


older | 1 | .... | 395 | 396 | (Page 397) | 398 | 399 | .... | 413 | newer