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

Embed this content in your HTML


Report adult content:

click to rate:

Account: (login)

More Channels


Channel Catalog

Channel Description:

WordPress › Support

older | 1 | .... | 318 | 319 | (Page 320) | 321 | 322 | .... | 413 | newer

    0 0

    I've been trying for the life of me to figure out how to change the default "thumbtack" icon of the "Posts" menu on the backend to something else. Unfortunately, when searching Google for this, all I get is how to do it with Custom Post Types—not the default/existing "post" post-type. I know with a Custom Post Type you use 'menu_icon' in your args when registering the Custom Post Type, but I can't figure out how to do it with 'post'.

    0 0

    Other than understanding the need to constantly check for updates, the ability to use the "right" plug-ins, and the amount of security someone like wp-engine will provide, I have little to no knowledge of other security measures to take.

    With that in mind should I move to a "self-hosted" or stick with I understand there is always a risk but would it be irresponsible of me to make the change without a better understanding of security?

    Also, will some of these security plug-ins, needed for someone who basically has no idea what he is doing otherwise, cost a significant amount?

    0 0

    Hi guys,

    I have modified ih-photographer(link) from wordpress themes to meet my requirements. I have created a custom post type named 'ht_restaurants' which accepts youtube links and shows them on videography page. I have used themes pagination code to display pagination links.

    My problem is, pagination does not work when permalinks setting has being switched to "post name". It shows 404 page.But when default pagination is set that time pagination works perfectly. For e.g. http://localhost/xxxxx/videography/page/2/ gives 404 error.

    `$pageno = (get_query_var('paged')) ? get_query_var('paged') : 1;
    echo "<h1>paged is " . get_query_var('paged') . "</h1>";
    $loop = new WP_Query(
    'posts_per_page' => 6,
    'paged' => $pageno

    and my pagination code is

    <div class="pagination text-center">
      $big = 999999999; // need an unlikely integer
      $loop_format = paginate_links( array(
        'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
        'format' => '?paged=%#%',
        'current' => max( 1, get_query_var('paged') ),
        'total' => $loop->max_num_pages,
        'type'  => 'array'
      ) );
        if( is_array($loop_format) ) {
            $paged = ( get_query_var('paged') == 0 ) ? 1 : get_query_var('paged');
            echo '<div class="pagination"><div><ul>';
            echo '<li><span>'. $paged . ' of ' . $loop->max_num_pages .'</span></li>';
            foreach ( $loop_format as $page ) {
                    echo "<li>" . $page . "</li>";
           echo '</ul></div></div>';

    Does anybody have a solution for this.

    0 0

    Hello everyone,

    I am creating a very simple Wordpress page (5 pages).
    The template is pretty simple but every single page have a different combination of boxes and information.

    That's why I decided to prepare 5 pages (without any posts).
    By default every page/post have Title and Body(content) Field.

    To make it simpler I am trying to write the Body in this way:

    [TOP PART]This is subtitle[/TOP PART]
    [BOX]This is my box 1[/BOX]
    [BOX]This is my box 2[/BOX].

    in my index.php I am trying to filter it with preg_match_all:

    $string =  apply_filters( 'the_content', get_post_field( 'post_content', get_option( 'page_for_posts' ) ) );
    $preg = preg_match_all('/\[BOX\](?:(.+?)?\[\/BOX\])/', $string , $matches);

    Unfortunately I received an empty Array. If I display the $string I see the content with this boxes.

    Any idea why preg_match_all() doesn't work with content of the post/page?

    0 0

    I'm using a real estate listing plugin. It's great except for one thing... the gallery portion. It's in a link format so when you click on a photo it takes you to the image's url.
    I just want to see if I can throw a snipet of php into the plugin's functions.php that'll create a thumbnail to full-size effect instead of redirecting the entire page.

    The client will be taking over after we finish the site and he wants to have to go through as few hoops as possible to put photos on the site, which is why I'm not using a separate gallery plugin (I can't find a free one that connects to the Post toolbar that has everything he wants)

    0 0

    I've got a bunch of product pages where at the bottom of each page is a table that shows in one column a part number for each version of the product, the description of the option, and then the price.

    All I want to do is add an additional column on the right with a Buy button. It would save a bunch of time if this buy button was smart enough to read the page title (to get the product name), and then the part number, description, and price in the same row of the existing table. Would save me A TON of manual input.

    I suppose there may need to be some id tags with a standard naming scheme so the javascript would know which cells to get the Buy Button params from.

    On the other hand, maybe just best to get load up OsCommerce or X-Cart or something and base the website off that instead of Wordpress and write a script to import the product images and descriptions in from the Wordpress site.

    0 0

    I want to make it so that posts are automatically made private, but also be completely visible to other users if they have the same user role. Additionally, Administrator posts should always be visible no matter the role. In order to make this work most effectively, I would create additional user roles (using the User Role Editor plugin, most likely) which all had Author privileges.

    I've tried a few plugins already, but none of them seem to be automatic or they don't work quite right. Plugins I've tried:

    • Advanced Access Manager
    • Restrict User Access
    • User Access Manager

    Is there another plugin that I simply haven't tried? Can something like this even be done? As it stands now, I am learning PHP -- which I want to do anyway -- but I'm wondering whether or not this is possible.

    0 0

    Is there any way to hide the Javascript code in the excerpt without manually adding a post excerpt?

    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 tool).

    Any suggestions would be much appreciated!

    0 0


    In the latest version of WordPress (4.3.1), how do I add an action/filter after the Add New Category or Add New <taxonomy_category> is clicked in the Dashboard? I have looked at the Plugin/API reference (, and all the entries that look like they would work here are in red and no details or examples exist. I would appreciate the help.


    0 0

    Hi team, its been a long two days in an attempt program a plugin from scratch to provide a front end landing page with 2 forms.

    Depending on which form the user wants to use, the form shall change a value in the database (add or create if nonexistent custom field "key"=>"value").

    Without luck, many several changes were made to the forms and the functions associated to manipulate $_POST and getting its value etc and without success!

    Is someone willing to take a look at my code below? The goal is to differentiate between two forms at the time of submission. After which, if the second submit button is pressed, a custom field value is updated in the wp_postmeta table.

    I tried pasting the code here, but its not going through.
    Please see

    0 0

    So I thought I had this working but now am having some issues.

    Basically, I'm trying to automatically unzip files when they are being uploaded within posts belonging to the CPT "publications". The trouble I am having is with the following lines of code:

    // Unzip the file after upload
    function sbh_after_upload( $file ) {
      $upload_dir = wp_upload_dir();
      $pub_dir = $upload_dir['basedir'] . '/publications';
      $extension = substr( strrchr( $file['file'], '.' ), 1 );
      if( $extension == 'zip' ) {
        require_once( ABSPATH .'/wp-admin/includes/file.php' );
        $unzip = unzip_file( $file['file'], $pub_dir );
        if( !$unzip ) {
            echo 'There was a problem unzipping the file.';
      return $file;
    add_filter( 'wp_handle_upload', 'sbh_after_upload' );

    The issue seems to be with the unzip function itself. I've done some troubleshooting, and for some reason nothing is being generated in the /publications directory. I've tried using the php's zipArchive class which doesn't seem to work either.

    0 0

    When I change my post status to a custom post status, the only option I have is to "Publish". But I don't want to Publish, I just want to update the post status.

    Here are my custom statuses:

    function ls_create_time_card_statuses() {
    	register_post_status( 'order-received', array(
    		'label'                     => _x( 'Order Received', 'post' ),
    		'public'                    => false,
    		'exclude_from_search'       => true,
    		'show_in_admin_all_list'    => true,
    		'show_in_admin_status_list' => true,
    		'label_count'               => _n_noop( 'Order Received <span class="count">(%s)</span>', 'Order Received <span class="count">(%s)</span>' ),
    	) );
    	register_post_status( 'order-assigned', array(
    		'label'                     => _x( 'Order Assigned', 'post' ),
    		'public'                    => true,
    		'exclude_from_search'       => true,
    		'show_in_admin_all_list'    => true,
    		'show_in_admin_status_list' => true,
    		'label_count'               => _n_noop( 'Order Assigned <span class="count">(%s)</span>', 'Order Assigned <span class="count">(%s)</span>' ),
    	) );
    	register_post_status( 'waiting-for-signature', array(
    		'label'                     => _x( 'Waiting for Signature', 'post' ),
    		'public'                    => true,
    		'exclude_from_search'       => true,
    		'show_in_admin_all_list'    => true,
    		'show_in_admin_status_list' => true,
    		'label_count'               => _n_noop( 'Waiting for Signature <span class="count">(%s)</span>', 'Waiting for Signature <span class="count">(%s)</span>' ),
    	) );
    add_action( 'init', 'ls_create_time_card_statuses' );

    0 0

    So I'm trying to get the text to wrap around my adsense block on a wordpress site.

    I'm editing the single.php file, and I'm putting in the following code.

    <div style=”display:block;float:left; margin: 5px 5px 5px 5px;”>
    <script async src="//"></script>
    <!-- test -->
    <ins class="adsbygoogle"
    (adsbygoogle = window.adsbygoogle || []).push({});

    I am putting this under, the content portion of the single.php file: the line reads:

    <div id="content" class="<?php echo $content_class; ?>" style="<?php echo $content_css; ?>">

    It wraps around the google adsense block perfectly, EXCEPT for it's pushing my header down, and also having it wrap around the adsense block.

    What am I doing wrong?

    0 0

    I am trying to set a cookie when the page loads with a number taken from user input in the back end of a widget and I can't seem to get it work.

    class my_class extends WP_Widget {
    ## get variable from the backend form settings of widget
          function form($instance) {
          global $instance;
          $title = ! empty( $instance['variableiwant'] ) ? $instance['title'] : __( 'variableiwant' );
            ##update save of widget
            function update($new_instance, $old_instance) {
                $instance = $old_instance;
                $instance['variableiwant'] = strip_tags($new_instance[ 'variableiwant']);
                return $instance;
            function widget($args, $instance) {
     ##here I try and set the cookie from the backend variable before headers are sent.
    function set_newuser_cookie() {
      global $instance;
      global $variableiwant;
    if (isset($_COOKIE["variablesave"]))
                setcookie("variablesave", $variableiwant, time()+3600);
    add_action( 'send_headers', 'set_newuser_cookie');

    Now the problem I have is the cookie can only be set before the headers are sent, I have tried other hooks before "send_headers" but nothing works. Obviously if you add the hook after the headers it throws an error saying "warning headers already sent" is there a way to grab that variable from the backend input and set it as a cookie before the headers are sent? I've tried everything and nothing seems to work the cookie is simply set as NULL.

    0 0

    Hi I'm just wondering the best way to do this. External php is 'Hacky' (explained after code) in Wordpress but works (see snippet below), I'm assuming by the nature of php i can't call a function inside the UI file (below):

    <input type="text" placeholder="function search" onkeyup="search(this.value)">
        xmlhttp.onreadystatechange = function() {
                       if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                           document.getElementById(\'search\').innerHTML = xmlhttp.responseText;
                    var locate = \''.plugins_url( 'locate.php', __FILE__ ).'\';
          "GET", locate+"?search="+searchInput);
    <textarea rows="15" cols="50" id="search"></textarea>

    i have to import wp files to check for admin status/get_home_path() etc, which requires a static '../../../' . This is because wp functions aren't loaded by 2nd. Will looking Hooks, Actions and Filters solve this issue? if so could you point me to the function/s i should use. (yep, i plan i learn this in great detail as soon as i get some sleep)


    0 0


    I'm hoping you can help me understand a problem I'm experiencing. I'm working on a page that shows posts categorised as 12 or 13 within a feed. There are two buttons at the top of the feed which, when clicked, hide some of the content - at least it should!

    To do this I have:

    • JS - written a piece of js that, upon clicking one of the buttons adds a class (either .turnedon or .turnedoff) to items with a specified class.
      //Extra javascript v1.1 should hide/unhide resultsblob classed as 13
      jQuery(document).ready(function() {
              jQuery('[data-categories="13 "]').addClass("turnedon");
              jQuery('[data-categories="13 "]').removeClass("turnedoff");
              jQuery('[data-categories="13 "]').addClass("turnedoff");
              jQuery('[data-categories="13 "]').removeClass("turnedon");
    • functions.php - I have enqueued this script within my custom functions php file
      function SHdemo_scripts() {
             wp_enqueue_script('extra js', get_stylesheet_directory_uri() . '/js/extra.js');
      add_action('wp_enqueue_scripts', 'SHdemo_scripts');
    • Wp_query - I have added the posts to the page via a new WP query and used the category id to assign a class to the containing divs
          //SH results feed ordered by date
          $resultsPosts = new WP_Query('cat=12,13&posts_per_page=9');
          if ($resultsPosts->have_posts()) :
         while ($resultsPosts->have_posts()) :
          $resultsPosts->the_post(); ?>
          <div class="resultsblob" data-categories="<?php
      foreach((get_the_category()) as $category) {
          echo $category->cat_ID . ' ';
      } ?>">
          <h2><?php the_title(); ?></h2>
              <?php the_content(); ?>
          //fallback no content message here
          //This stops wordpress from killing life

    So my wpquery dumps all the content on my page assigning each item a class based on its ID and then my javascript adds the class .turnedon or .turnedoff to these items depening on which button is pressed.

    The problem I'm experiencing is that while the JS has no problem interacting with the standard HTML on the page, it just cannot see the HTML supplied via the WPquery. Is this something to do with the order that the js is called compared to the wp_query being run?

    Hope you can help.
    Many thanks

    0 0

    I've been googling this topic and forum moderators seem reluctant to answer the question and instead only offer solutions to the underlying problem. But the real question is: What is the suggested way to override a WordPress core php file (ie. something in the wp-admin or wp-includes dirs)?

    Yes, yes, I know, this is not recommended because when WP updates are made, any files that overwrite the updated files will either be overwritten, or just cause problems...

    But there are times when the core files just don't provide the flexibility to filter their output, so what can you do? You have to hack the core!

    Solution 1:
    I could write a script to modify the latest core file every time I update wordpress; but that is a pain in the arse.

    Solution 2:
    I could copy the core .php file into my theme dir and then include() it or possibly enqueue() it and then what? remove_action() add_action(), but the problem I see with that is that the new add_action function handle needs to be the same as the old in order for it to be called by existing scripts. So it would be nice to have some guidance for the proper way of doing this.

    Note: I'll open a separate question related to the underlying problem I'm having with a particular core file.

    0 0


    My wordpress header file having unwanted script tag with some URL. I have removed this script manually but its coming again regularly.

    Please let me know what is the cause for this and how to permanently avoid this issue.


    0 0


    I'm having a strange problem. From time to time (approximetly 2 per week) I see in google (typing and searching manualy) some fake links generated by some maleware. The problem is, that the links are not redirected to any site but to 404 error (example from today: ) which bother me finding specific line in code.

    Did anybody have simmilar problem? What can I do?

older | 1 | .... | 318 | 319 | (Page 320) | 321 | 322 | .... | 413 | newer