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 | .... | 388 | 389 | (Page 390) | 391 | 392 | .... | 413 | newer

    0 0

    hi @ all,

    i've got a problem by adding customfields into ma wiordpress theme. the name/id of the customfield shell be predefined, the Text/value shell be customizable.


    add_action( 'save_post', 'kb_custom_field_default', 10, 2 );

    function kb_custom_field_default( $post_id, WP_Post $post ) {
    if (!get_post_meta( $post_id, 'CUSTOM-FIELD-KEY', true ) ) {
    update_post_meta( $post_id, 'a, 'value1' );
    update_post_meta( $post_id, 'b', 'value2' );
    update_post_meta( $post_id, 'c', 'value3' );


    So how can i release this. ID/name is working but the value is always the one i typed into the functions.php (value1, value2, value3) how can i change that to custom text?

    best regards

    0 0

    Hi, a while back i found the code below on a forum.

    It does exactly what i would like it to do; it displays a menu made up of a custom taxonomy without any anchors, in which a 'current' class gets added to the list items when applicable.

    The problem is that this code doesnt give individual classes to each list item so i cant style them individually. Does anyone know how i might add them?

    	 // Get terms for post
    	 $currentterm = get_the_terms( $post->ID , 'product-types' );
    	 // Loop over each item since it's an array
    	 if ( $currentterm != null ){
    	 foreach( $currentterm as $current ) {
    	} }
    	$terms = get_terms('product-types', array(
    	 	'orderby'    => 'ID',
    	foreach ($terms as $term) {
    	$class = $current->slug == $term->slug ? 'current' : 'notCurrent' ;
    	echo '<li class="'. $class .'">' . $term->slug . '</li>'; 	}

    0 0

    I am working on a button which allows you to add images to a post.
    I did so using the following code which open a frame of the media library.

    frame ={
        title: 'Select or Upload',
        button: {
            text: 'Use this media'
        multiple: false,
        frame: frame_type

    My problem is that I want the frame to only show specific media types e.g. only images or only videos.
    Is there a way to achieve that behaviour?

    0 0

    Is it possible to add git hub libraries in worpdress ?
    if yes can anyone tell me how i can integrate it.
    Thank You

    0 0

    Heya guys,

    I am working on a solution to add B2B customer acvcounts to wordpress. To facilitate that, the main account should be able to view the orders of its employees (which are other wordpress users). I succeeded to make a table with the necessary orders on the my account page, but I am stuck on view-order page. I found out that if I would change _customer_user in wp_postmeta, I would be able to view the order.

    I have tried putting the following code at the beginning of view-order.php:

    global $wpdb;
    $sql="UPDATE wp_postmeta SET meta_value = '9' WHERE meta_key =4683";

    The problem is that it executes after all the necessary details are loaded, so I am getting an invalid order error. Of course, in a later point, I would change 9 tot get_current_user and meta_key to order_id and meta_key. So my question is where should I put this function for it to work correctly?


    0 0

    Hi guys appreciate any help here

    I figured out how to edit the stream title on my website player via CSS

    Now what I'm trying to do is get the css to display the current slot on the timetable (so it shows the dj name that should be live)

    website - (excuse the URL as it's a test url)

    CSS I'm using to edit the stream title -
    #strm_radio .nowPlaying h5 a.streamName.icon-signal::after {
    content: " DJ NAME HERE";

    Is there anyway to get it to display the current time slot dj? Or anybody know any better of doing this?


    0 0

    I am using contact form7 plugin for my form. I was try to insert the data's of a form into table. I have created table and used insert function to store data (in MYSQL).But it stored as "NULL".

    This is my code

    function contactform7_before_send_mail( $form_to_DB ) {
    global $wpdb;
    $form_to_DB = WPCF7_Submission::get_instance();
    if ( $form_to_DB ) {
    $formData['posted_data'] = $form_to_DB->get_posted_data();
    $name =$formData['posted_data']['name'];
    $mail =$formData['posted_data']['e_mail'];
    $wpdb->insert( 'wp_cf7_test', array( 'name' => $name ,'e_mail' => $mail) );
    remove_all_filters ('wpcf7_before_send_mail');
    add_action( 'wpcf7_before_send_mail', 'contactform7_before_send_mail' );

    By googling I got this but its not working fine for me.
    Any help will be helpful to me as am a newbie.

    Thanks Sallu.

    0 0

    I have an alert function in an updatepage.js file:
    function hello() {alert ('Hello world!');}
    On my post page (set to 'text' view) I have

    <script type="text/javascript" src="/updatepage.js" </script>
    <script type="text/javascript"> <!-- hello(); --></script>

    When I refresh the page, I don't get the alert.
    I'm working up to having the alert message show with every WordPress heartbeat, but one step at a time.

    0 0

    I have defined three custom fields namely and i have them in my page-home.php. It gives me back the image url

    $inside_image_1 = get_field('inside_image_1');
    $inside_image_2 = get_field('inside_image_2');
    $inside_image_3 = get_field('inside_image_3');

    I want to have some something like

    <a class="project-item web-design" href="" data-images="assets/projects/folder/web.jpg,assets/projects/folder/lh.jpg">

    The custom field is not required. I want to write a query to display image 1 url if user has uploaded one, display image1 and 2 and three if he has uploaded both or all the images like above where user has two images uploaded.

    0 0

    I am trying to show all posts that have a specific post type (either 'dog' or 'cat') and have the field 'virtual_adoption' set to '1'.
    I've coded for the 'dog' and 'cat' in the same way. The 'dog' is working fine, but the 'cat' only bring the permalink and image for the page, not for the specific cat.
    It seems the 'dog' is 'in the loop' and the 'cat' not.
    Why isn't it working the same for both of the post types? How do I get the 'cat' to bring the 'cat' permalink and image?

    $posts = get_posts(array(
    	'post_type'=> 'dog',
    	'meta_query' => array(
    		'key' => 'virtual_adoption',
    		'value' => '1',
    		'compare' => '=='
    $posts_c =  get_posts(array(
    	'post_type'=> 'cat',
    	'meta_query' => array(
    		'key' => 'virtual_adoption_cats',
    		'value' => '1',
    		'compare' => '=='
    	<?php foreach( $posts as $post ): setup_postdata( $post ) ?>
    	<div style="display: table-row;" class="vrow">
        		<div style="display: table-cell;" class="virtual_image">
    				<?php if ( has_post_thumbnail()) the_post_thumbnail('pet-image'); ?>
      		<div style="display: table-cell;" class="virtual_name">
    			<a>"><?php echo "Sponsor "; echo the_title(); echo ':'; ?></a>
    			<span class="field_v_label"> <?php echo ' Age:'; ?> </span> <?php echo get_field( "age_range_dog" ); ?>
    			<span class="field_v_label"> <?php echo ' Information:'; ?> </span> <span class = "field_v_content"><?php the_content(); ?></span>
    	<?php endforeach; ?>
    	<?php wp_reset_postdata(); ?>
    	<?php foreach( $posts_c as $post_c ): setup_postdata( $post_c ) ?>
    	<div style="display: table-row;" class="vrow">
        		<div style="display: table-cell;" class="virtual_image">
    				<?php if ( has_post_thumbnail()) the_post_thumbnail('pet-image'); ?>
      		<div style="display: table-cell;" class="virtual_name">
    			<a>"><?php echo "Sponsor "; echo the_title(); echo ':'; ?></a>
    			<span class="field_v_label"> <?php echo ' Age:'; ?> </span> <?php echo get_field( "age_range_cat" ); ?>
    			<span class="field_v_label"> <?php echo ' Information:'; ?> </span> <span class = "field_v_content"><?php the_content(); ?></span>
    	<?php endforeach; ?>
    	<?php wp_reset_postdata(); ?>

    0 0

    how to use wp_handle_upload for multiple files.
    this is input box...

    <input class="test" id='upload' name="upload[]" type="file" multiple="multiple" required/>
    not getting how to use...


    0 0

    I'm having a little problem that at first may seem insignificant but it's really turning into a huge headache.
    It has to do with the Media Library, specifically in the "List" view.
    I have over 1600 images (with several thousand more to add) that corresponds into over 80 pages of items.
    The problem is, if I'm editing an image on, say page 35, when I save the changes, the library refreshes back to page 1 of the library. So now, if I'm working on things in certain order I have to click the next arrow 35 times to get back to where I was. If i'm on a computer with a slow connection this can really become a problem.
    Is there something I can do that will make the save refresh to the current page I'm on in the library?

    0 0

    Hi all

    I need to get rid of query strings (?=ver... ) added to .js and .css
    I found a useful plugin called "Zendy Speed: Query Strings" which remove query strings
    BUT it goes in conflict with the async script that I use in my functions.php to add "async" to certain .js

    the async script is this:

    // Start
    function the_async_scripts($url)
    if ( strpos( $url, '#asyncload') === false )
    return $url;
    else if ( is_admin() )
    return str_replace( '#asyncload', '', $url );
    return str_replace( '#asyncload', '', $url )."' async='async";
    add_filter( 'clean_url', 'the_async_scripts', 11, 1 );
    // End

    when I activate the zendy plugin this script ends to work, so I get rid of query strings but can't put async .js.
    If zendy plugin is deactivated, instead, I have "async" in the script but have query string too...

    can someone help?

    0 0

    Is there a way I can set the current archive in year on my sidebar in single posts?

    I am using <?php wp_get_archives('type=yearly'); ?>, I would like to have my lists like <li class="current"> for the year.


    0 0

    I'm trying to change how my featured images display on screen. If I use the standard given in the codex:

    <?php  if ( has_post_thumbnail() ) {
    } ?>

    I get an <img> tag placed in place. I instead want the featured image to display as a part of a div's background.

    Something like:

    <div class="featured-img" style="background: url( <the featured image> ) no-repeat; background-size: cover;"></div>

    So I tried this:

    <?php  if ( has_post_thumbnail() ) {
       echo '<div class="featured-img" style="background: url(' . the_post_thumbnail() . ') no-repeat; background-size: cover;"></div>';
    } ?>

    Which still inserts an <img> above the newly created <div> element. But the <div> element has the background of url(). Why is this?

    I even tried changing the_post_thumbnail() to the_post_thumbnail_url() and all that did was include a text element with the URL above the DIV just like the other time.

    I'm hoping that I'm just missing something obvious.

    Thanks in advance!

    0 0

    Hi! I'm using Ajax Load More to create an infinite scroll of posts and, in each one, I want to use a news ticker (Ditty News Ticker)... And I got a few problems. The first post works fine. When I scroll and ajax injects the other ones, it does not.

    First things first: the problem is not EXACTLY with shortcodes, it is with plugins that can be run using shortcodes; and it happens only on the scroll; directly loaded pages works fine. Shortcodes that are registered in my functions.php WORKS. Plugins that works with shortcodes, does not.

    This is the function I am using to call the ticker.

        if (function_exists('ditty_news_ticker'))
        { ditty_news_ticker( 1487 ); }

    The problem is: the plugin does not seem to get loaded when the ajax content is loaded. Using this code as a test, you can see that it literally says that the function does not exist.

    	if (function_exists('ditty_news_ticker')) {
      		echo 'ditty_news_ticker() exists! Yay!';
      		ditty_news_ticker( 1487 );
    	} else {
      		echo 'ditty_news_ticker() does not exist';

    Using the shortcode (inside the_content or outside, using do_shortcode), all I get is a plaintext version of the shortcode. I tried that filter that is on FAQ and nothing happened, all the same.

    With Shortcodes Ultimate, another plugin, it's even more bizarre: the shortcode IS executed, but the CSS does not work. It creates the DIVs that are supposed to create columns, but it doesn't load the CSS that does this.

    All of this is being loaded within the_content and/or the repeater templates.
    Other plugins (like coauthors, for example) works great.

    So, that's what we have. For some reason, plugins+shortcodes doesn't work when the ajax inject content for the second time.

    Searching, I found this:

    This is the most similar issue I found... Maybe that's a way?

    0 0

    As far as I know the excerpt of PHP I am adding to the functions.php file is not in the loop so it should not be in theory showing on all my site pages but yet it is.
    The code is this:
    require( 'cicons/cicons.php' );
    Anyone know what may the problem? Do you need some more information?

    0 0


    I am want to disable all functions (hooks).

    I am just using simple gets. (wp_post_meta).

    e.g. just work post function. "Disable RSS, Disable comment, Disable users, Disable javascripts, disable thumbnails, disable attacments, disable plugins, disable date archive, disable search, and disable more..."

    0 0

    HI all,
    Is there a way to modify a URL including a Tab id PLUS the Comment id in the same url?

    I'm. using the plugin Comment Email Reply
    After each comment, I receive an email with this URL

    Do you know guys If there is a possibility to include also the Tab id… something like…
    http://Url /#tab-reviews /#comment-8

    I have tried manually but the URL I generated is not working.
    Any suggestion is more than appreciated.
    Thanks in advance

    The plugin Code is this, any advice is more than appreciated.
    Thanks in advance

    * Plugin Name: Comment Email Reply
    * Plugin URI:
    * Description: Simply notifies comment-author via email if someone replies to his comment. Zero Configuration. Available in English and German. More languages welcome.
    * Version: 1.0.4
    * Author: Jan Eichhorn
    * Author URI:
    * License: GPLv2

    load_plugin_textdomain('cer_plugin', false, basename( dirname( __FILE__ ) ) . '/languages' );

    # Fire Email when comments is inserted and is already approved.

    function cer_comment_notification($comment_id, $comment_object) {
    if ($comment_object->comment_approved == 1 && $comment_object->comment_parent > 0) {
    $comment_parent = get_comment($comment_object->comment_parent);

    $mailcontent = __('Hello ','cer_plugin').' '.$comment_parent->comment_author.
    ','.$comment_object->comment_author.' '.__(' replied to your comment on','cer_plugin').
    ' comment_post_ID).'">'.get_the_title($comment_parent->comment_post_ID).


    '.__('Go to it or reply:','cer_plugin').
    ' comment_ID ).'">'.get_comment_link( $comment_parent->comment_ID ).'';

    $headers = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
    $headers .= 'From: '.get_option('blogname').' <'.get_option('admin_email').'>' . "\r\n";

    wp_mail($comment_parent->comment_author_email,'['.get_option('blogname').'] '.__('New reply to your Comment','cer_plugin'),$mailcontent,$headers);

    # Fire Email when comments gets approved later.

    function cer_comment_status_changed($comment_id, $comment_status) {
    $comment_object = get_comment( $comment_id );
    if ($comment_status == 'approve') {
    cer_comment_notification($comment_object->comment_ID, $comment_object);

    0 0


    We are trying to get some custom search links with parameters to not include the parameters and output as a 'pretty url'.

    (the search page returns villas that are in a specific region (category)

    We would like this:

    to look like this:
    /villa_rental_italy/region/regions-venetia (or simillar)

    We have tried (and various variants) of this:

    [ Moderator note: code fixed. Please wrap code in the backtick character or use the code button. ]

    function create_new_url_querystring() {
        add_action('init', 'create_new_url_querystring');

    which hasnt worked, any input would be greatly appreciated.

    many thanks Sam

older | 1 | .... | 388 | 389 | (Page 390) | 391 | 392 | .... | 413 | newer