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 | .... | 392 | 393 | (Page 394) | 395 | 396 | .... | 413 | newer

    0 0

    I have a question regarding uploading new posts to wordpress.

    Our website publishes newsletter-posts on a daily basis. At the moment the newsletters are manually added as new posts each day (image + text related to the image). We are however considering automizing this process.

    So what I would like to do is internally generate the whole post as a php file and then upload this file to wordpress directly, instead of going through the wordpress UI. So in this php file I would have the text plus the image reference and I would specify all the parameters I need such as the post category, the tags... Of course I would still have to upload the media contained in the post to wordpress, but I have seen some solutions online to do this 'programatically'.

    Is it possible to upload such a php file directly to wp as a post? How would I go about doing this?
    thank you,

    0 0

    I have a (I think) rather unique issue.

    I would like to append a custom query string to a standard WP search query.

    On my client's site, we have a section called Beautyscopes that is powered by an in-house plugin that generates the page content. Unfortunately, when this plugin was first created around 10 years ago, all data elements were created in the wp-options table, as opposed to being put into the standard wp-posts table. (I did not write the plugin myself, but as webmaster and site co-founder, I have maintained it for many years)

    As a result, any standard search will not return results from that table, since wp-options is not queried as part of a standard search. And this hurts the site's SEO to a decent extent.

    What I am basically trying to do is:

    1) create a custom query using a string variable
    2) append that string variable to the standard WP search query

    Here is the standard search WP query that is currently used on the site:

    $page_query = new WP_Query("s=$s&paged=$paged&showposts=10&orderby=date");

    And the standard code after:

    if ($page_query->have_posts()) :
    		$wp_query= null; $wp_query = clone $page_query;
    <?php $postCount=0; ?>
    <?php while (have_posts()) : the_post();?>
    <?php $postCount++;?>
    	<div class="entry">
                  <blah blah blah>

    And here is the query I would like to append to the search query:

    $scopes = new WP_Query("SELECT * FROMwp_optionsWHEREoption_nameLIKE '%bscopes%'");

    I am using the %% operator since each option name has a unique ID as follows:

    bscopes_2007_09 (for Sep 2007)
    bscopes_2007_10 (for Oct 2007)

    and so on. So therefore, i cannot use a strict matching query. However, this is suitable for what I am trying to do.

    Now, if I append the $scopes variable to the search query as follows:

    $page_query = new WP_Query("s=$s&paged=$paged&showposts=10&orderby=date&scopes=$scopes");

    it unsurprisingly white screens all code after that line is encountered.

    Maybe I am being dense, but I am not seeing how to seamlessly append that $scopes query to the search query anywhere and am rather stuck.

    Any advice is appreciated.

    0 0

    As I understand it there is in "WP a request time out", which has a standard setting of 5 seconds.
    Is this a limit on the duration of making a request only, or does it include also the time taken by any back-end processes that service the request?
    If that is not the case what is the limit execution process on the back-end? Also, what relationship has this got with the PHP Maximum_execution_time, which appears to be generally standardized to 30 seconds?

    0 0

    I am trying to make mobile application for creating wordpress posts. But I am unable to do it using XMLRPC. There is no error returned. I passed image id as 'wp_post_thumbnail" and "post_thumbnail". I tried using custom field but nothing helped. It is stored as a column started with _ in meta for the post so I cannot change that directly. What do you suggest me?

    0 0

    I wanted to know what's the advantage of adding a class structure to your plugin rather than just calling the functions and when it's appropriate to use them.

    0 0

    Hey guys,

    my WP theme gives me a HTML-Shortcode called [detail].

    Behind [detail], there's a link, which only can be displayed with the shortcode.

    Now I want to proof, if the link, that is behind the shortcode, has a certain length. Only if the link has that certain length, it's displayed on the frontend.


    $link = "[detail]";
        if(strlen($link) > 3) {
                  #Display Link
         else {
              #Don't display link

    Problem is, that PHP doesn't save the actual link in $link, but only the length of the shortcode [detail] - so eight signs.

    The IF condition of course, always displays the link, because [detail] has eight signs, which is bigger that three.

    As I mentioned, [detail] is a HTML Shortcode, so I have to use the " " with the variable.

    Hoping for help. Thanks!

    0 0

    In my plugin, I am getting an error with wp_redirect.

    Here is my code:

    public function update($year, $edit_id, $column1, $column2) {
    		global $wpdb;
    		$table_name = $wpdb->prefix . 'tableName_'.$year;
    		$Column1 = intval($column1);
    		$Column2 = intval($column2);
    		$NewTotal = ($Column1 + $Column2);
    		$wpdb->update($table_name, array('Column1' => $Column1, 'Column2' => $Column2, 'Column3' => $NewTotal), array('month_id' => $edit_id));

    I know that the code is working until I get to wp_redirect.

    I get the following error

    Warning: Cannot modify header information - headers already sent by (output started at /home/.../public_html/wp-admin/includes/template.php:1953) in /home/.../public_html/wp-includes/pluggable.php on line 1171

    Any help would be greatly appreciated

    0 0

    Hello All,

    I have created a custom post type named "coupon" and wish to redirect any single post in this post type, which is in draft, to a new URL. I am using the following code but for some reason, it is not working.

    function redirect_scp() {
        if(!current_user_can('administrator')) {
        	global $post;
        	if( is_singular('coupon') ){
        		if ( $post->post_status == "draft") {
    				wp_redirect( '<url_to_redirect_to>', 301);
    add_action('wp', 'redirect_scp');

    Any help will be appreciated.
    Thanks in advance.

    0 0

    Hey all

    I have a monitor running, showing the front page of the blog (I run the wordpress backend locally) - I would like this to work similar to a live update/blog, but I dont know how to automatically update the clients when changes are made to the post.

    Is there away to make clients update automatically, on new posts/updated content? As said the wordpress runs locally so I can make some custom changes, I am just not sure where to start.

    Can you help me?


    0 0
  • 06/20/16--08:14: guylancaster on "login"
  • I have a progamatic login system for users. This works fine

    But when im in admin, and select a user and try and programatically login , it ignores me!

    Code below....

    $user = get_user_by('id', $userid );
    if( $user ) {
    wp_set_current_user( $user_id, $user->user_login );
    wp_set_auth_cookie( $userid );
    do_action( 'wp_login', $user->user_login);

    0 0

    Hi, I´ve got problem with generating thumbnail on new version WP.
    I make my thumbnail with resolution 500x500px.

    If I call:
    echo get_the_post_thumbnail($post->id, 'my-thumbnail-size-500-500');
    I get:
    <img width="5760" height="3840" src="domain.CCCC/..._XXL.jpg" class="attachment-my-thumbnail-size-500-500 size-my-thumbnail-size-500-500 wp-post-image img-responsive" srcset="domain.CCCC/..._XXL.jpg 5760w, domain.CCCC/..._XXL-300x200.jpg 300w, domain.CCCC/..._XXL-768x512.jpg 768w, domain.CCCC/..._XXL-1200x800.jpg 1200w" sizes="(max-width: 5760px) 100vw, 5760px">

    If I disable srcset:
    function disable_srcset( $sources ) {
    return false;
    add_filter( 'wp_calculate_image_srcset', 'disable_srcset' );
    and call get_the_post_thumbnail like up, I get:
    <img width="5760" height="3840" src="domain.CCCC/..._57573024_XXL.jpg" class="attachment-my-thumbnail-size-500-500 size-my-thumbnail-size-500-500 wp-post-image img-responsive" >

    BUT i need:
    <img width="500" height="500" src="domain.CCCC/..._57573024_XXL_500-500.jpg " class="attachment-my-thumbnail-size-500-500 size-my-thumbnail-size-500-500 wp-post-image img-responsive" >

    Anyone knows?

    0 0

    I'm working on a simple plugin (my first) that converts a given shortcode with a URL as the input parameter into an iframe src. For example [Frame mylink=""] This works perfectly, except…

    If the user is working in TinyMCE's 'Visual' mode and copy/pastes the URL from an email into the editor, it often comes along with the <a> tag and turns into a clickable anchor rather than plain text. This breaks the shortcode. I can't even seem to get the parameter to pass through to my function at all if it's been wrapped with HTML.

    Is there a way around this?

    0 0

    Hey all,

    So I have all of my users as contributors which can only make posts, but they can still see all of my plugins and crap in the sidebar. Can someone show me what wp-admin file I can use to screw around with that?

    I only want Posts to show up in the sidebar on the back end.


    0 0

    As going from Text to Visual editing causes TinyMce to strip code a href="openCalendar('DateIn')".... from a link that opens a datepicker window., I looking for a way to prevent this. I can't take the chance the code will be stripped out when the file is being edited by others.

    I've read that the proper way to do this is to either use a plugin that prevents the stripping, enqueue it or create a shortcode, or create a class...?

    As the plugins mentioned don't look up to date, I'm hoping for a simple explanation on how to use the enqueue, shortcode or class. I have a functions.php in my child theme, but have no idea what code would go where and what the link would look like. Thank you for this info.

    0 0

    I've been spending a lot of time on getting hierarchical customs posts to work. It looks like the rewrite rules do not work for that.

    The custom post used to be non-hierarchical and that worked just fine. After that I changed it to hierarchical and flushed the rewrite rules. I can see that the rewrite rules have changed.

    But... the permalinks do not work anymore (result: 404).

    Setting the custom post back to non-hierarchical (and flushing) makes everything work again.

    I have set the permalink settings to postname. If I change it to plain all is well for the hierarchical custom post, but plain is not what I want.

    I've searched the forum but have not found a solution to this.

    Is this a known bug? Am I doing something wrong? Any ideas?

    0 0

    Hi all,

    Like many of you, I've used Redirection a lot. It's very nice to just say

    /someurl 301 =>

    However it keeps these redirects globally for every subsite.

    There's about 2,8xx plugins that come up in search and after losing track of how many pages I went through, I can see this isn't a common thing. Most are redirects after specific events like login/out, first visit, etc.

    If anyone has a plugin that can do this on WP MultiSite on a per-subsite level, I'd really love to know.

    Thanks in advance!

    0 0

    I have a website that I'm using this code:

    <?php if ( !wp_is_mobile() ) { ?>
    	<div id="header-image" style="background-image: url('<?php the_field('header_image'); ?>'); height: 530px; background-position: center <?php the_field('header_background_position'); ?> ">
    	<main role="main">
    	<?php } else { ?>
     		<main role="main" style="margin-top: 50px">
    	<?php } ?>

    Now this works on hiding the <div id="header-image"> from mobile phones and iPad/iMinis. But I have an Acer Android tablet and the <div id="header-image"> does display, when it shouldn't.

    How may I modify the function to include this tablet (and all other types) device?

    Thank you.

    0 0

    I'm trying to have a button activated on page load. Instead of the "click to show map" button showing, I would like to trigger that so the map shows up on the bottom of the page. I've tried looking in the .php, tried .trigger() and a few other options, nothing seems to be working. Any ideas? I want the map to show on page load.

    0 0

    Hello, I am using twentysixteen theme and I would like to make it's search bar to redirect to custom page, for example, if I type into the search bar "dogs" it would bring me to the page called "dogs" instead of search page. Or maybe it would be easier to get rid of magnifying glass button and make search bar so I could only type in it? Because I have a plugin that instantly suggests and takes me to page, if you press on suggestion. If so, how do I do that? Any help would be appreciated, thanks.

    0 0

    Hey there,

    Sorry to ask, but can someone share an example of the delete_theme function?

    I'm working on an /install.php script inside wp-content were you can set things in default. And I want to make it to delete the default theme's it comes with WordPress.


older | 1 | .... | 392 | 393 | (Page 394) | 395 | 396 | .... | 413 | newer