• Resolved Myslovo

    (@myslovo)


    Hi there,

    hope this is right place to post my question.. So I run WordPress site as a dictionary, you can check a single entry here: http://myslovo.com/?dictionary=%D0%B0%D0%B1%D0%B5%D0%BB%D1%8C%D0%BD%D0%BE . I want to add just two words of a plain text “Added by” (in Ukrainian) before that “Robert”. I surfed all the files of both theme and plugin (and tried to edit some of them), but can not understand where is it.. I assume this is plugin thing, coz I’ve changed three themes, and that “Robert” always appears at the same place..

    please give me any advice or link where I can read about this.. I’m asking here coz the developer from whom I bought plugin and theme doesn’t reply to my messages.. please contact me if you have any questions..

    Best,

    Alex

Viewing 14 replies - 1 through 14 (of 14 total)
  • Moderator bcworkz

    (@bcworkz)

    Yes, this does appear to be a plugin feature. Unfortunately, we cannot help you with commercial plugins because we do not have access to the source code.

    If all else fails, you might be able to inject the desired text using jQuery after the page loads. Sorry I can’t help more.

    Thread Starter Myslovo

    (@myslovo)

    bcworkz,

    thank you for reply. maybe i can post here a list of files’ names and you can guess which of them is responsible for this element? or maybe you can just write which file is normally responsible for tags (or maybe that is category)

    or maybe you can give me a link where I can read about how this is constructed..:) sorry, too much stupid questions but I am looking for help here.. of course I can find solution myself (and I will do) but maybe someone can help me to step on the right path sooner..

    Best,

    Alex

    Thread Starter Myslovo

    (@myslovo)

    maybe it is possible to add that two small plain text words in theme CSS? I tried with no success..

    here is a piece of code responsible (I think) for that tag:

    }
    	.entry_type_list {
    		margin: -5px 0 10px 0;
    		padding: 0;
    		overflow: hidden;
    	}
    		.entry_type_list li {
    			display: inline-block;
    			float: left;
    			margin-right: 10px;
    			font-size: .9em;
    			font-weight: bold;
    			font-style: italic;
    		}
    		.entry_type_list li a {
    			display: inline-block;
    			float: left;
    			color: #FFF;
    			background: #666;
    			text-decoration: none;
    			padding: 2px 4px;
    			-webkit-border-radius: 6px;
    		          border-radius: 6px;

    Best,

    Alex

    Moderator bcworkz

    (@bcworkz)

    Organization of plugin code can be very erratic, I couldn’t even make a wild guess where you would need to look.

    CSS does not have the ability to add text content. However, it can add background images to HTML containers. You may be able to create an image of your text content and set it as a background image and use additional CSS to push the Robert button to the far right of the container over a blank portion of your background, so that only your Added By text as image is showing on the left. I hope that makes sense.

    I am no CSS expert, so I’m unsure of the proper directives, I usually just stumble around trying different things until I get the desired effect. You can do this as easily as I.

    Also consider using jQuery to insert the text. I’m no expert in jQuery either, but as a start, select ul.dictionary entry_type_list, get the current HTML content, add your text to the front of it and set the element’s content with the modified HTML.

    A big advantage of the jQuery approach is your modification will not be lost when the plugin gets updated.

    Thread Starter Myslovo

    (@myslovo)

    Dear bcworkz,

    thank you very much for addressing my problem. I’m continuing to investigate it and really appreciate your time and effort. I will try to understand what you wrote (sorry, I’m very slow and at this point have a very blurred understanding what CSS is, not talking about jQuery..)

    what I’ve found few hours ago is that I can add that in the file called “wp-dictionary/required/filters.php” – I suppose it’s name doesn’t matter but the responsible piece of code is

    $origin = wpd_get_origin( $post->ID );
          $types = get_the_term_list( $post->ID, 'types', '<ul class="dictionary entry_type_list"><li>', '</li><li>', '</li></ul>' );
          $related_entries = wpd_get_related( $post->ID );

    Robert is type. I’ve added two words somewhere in that $types lines, and they appeared on the website, but with unnecessary space (paragraph). when I started to put it in the different locations, but never get the effect back, only “Parse error: syntax error, unexpected T_VARIABLE in” very often..

    maybe you know what can be done with this two lines of code. I am continuing to try, but my knowledge is absent..

    thank you again for your participation,

    Best regards,

    Alex

    Moderator bcworkz

    (@bcworkz)

    Huh, “Robert” is output by this code? This means it is a term of the taxonomy “types”. Would never have guessed that 🙂

    Anyway, the last 3 parameters (the HTML with the angle brackets) is arbitrary text that goes in front of terms, between each term, after terms, respectively. If you wanted a comma delimited line instead of a list, the parameters could be '', ', ', '<br>'. If it is appropriate to add “Added by:” to the output of all calls to this wpd_get_original() function, change the one line to this:
    $types = get_the_term_list( $post->ID, 'types', 'Added by: ', ', ', '<br>' );

    You can adjust the text somewhat if what I propose does not exactly meet your needs, but you will need to be careful to maintain proper syntax. For example, you may need to add a <span> element or two in order to be able to properly style the text with CSS.

    Thread Starter Myslovo

    (@myslovo)

    bc workz!!!!

    thank you very very very much!

    btw:) “Also consider using jQuery to insert the text. I’m no expert in jQuery either, but as a start, select ul.dictionary entry_type_list, get the current HTML content, add your text to the front of it and set the element’s content with the modified HTML.” — you wrote this. doesn’t this mean that Robert was type?:)

    khe-khe, maybe I can ask you another question.. as we say in Ukraine, appetite comes at the course of eating:) Probably you know how to add the date after that “Robert”, so it will be “added by Robert on 11/08/2013”. I see the date in my dashboard (but never on the website) so I assume it can be called easily (if you know WordPress code)..

    I promise you this is the last question to you in this thread! I sent you one hundred eighty nine thanx!

    Best,

    Alex

    Moderator bcworkz

    (@bcworkz)

    You are most welcome.

    In hindsight, I guess “type” is obvious. At the time it was just a class label that conveyed no special meaning. I was unaware of your taxonomy. No matter, this knowledge would not have helped me. It was your ability to identify the code responsible for the output that helped. This success is entirely your own doing, I merely added some useful WP knowledge.

    You should get the post date by replacing the '<br>' with ' on' . get_the_date() . '<br>' . The date will be formatted as specified on the admin settings panel, but format parameters can be passed to get_the_date() to override the defaults.

    Thread Starter Myslovo

    (@myslovo)

    Dear bcworkz,

    thank you very much for your time. I copied your code, but I only got “on” word without date. then I changed date format, but that didn’t help. I tried to insert few other things, but got either nothing or parse error..

    maybe this is because the entry (as long as I understand) is a combination of two (or more?) posts (I think that gray area “example” is another post)
    maybe you can direct me where to search. (or maybe this time is blocked somewhere in the plugin?) or otherwise help:)

    thank you very much for the help you already gave

    Best,

    Alex

    Moderator bcworkz

    (@bcworkz)

    You must have simply misunderstood my instruction, understandable since the forum’s parser handles single lines of code different than blocks of code, I can see how you may have gone astray. I tested my code and it works as expected. Here is a different presentation including the original adjacent lines so it is more clear what needs to change.

    $origin = wpd_get_origin( $post->ID );
          $types = get_the_term_list( $post->ID, 'types', 'Added by: ', ', ', ' on ' . get_the_date() . '<br>' );
          $related_entries = wpd_get_related( $post->ID );

    Thread Starter Myslovo

    (@myslovo)

    bcworkz,

    thank you for your reply

    it looks like I did correctly what you said last time, and I repeated copying the code from your current reply twice now, with the same result, only “on” visible.. (I removed it for now as I don’t need that “on” without a date)

    I think I will read more documentation in try to understand the nature of this and later will ask this in another topic if don’t fix myself.. However if you feel that you’d like to further investigate the problem feel free to do so here:) (I suppose the reason is that one dictionary entry is two WordPress posts)

    again thank you very much for your help, I feel like a WordPress hacker now:)

    Best,

    Alex

    Moderator bcworkz

    (@bcworkz)

    (I suppose the reason is that one dictionary entry is two WordPress posts)

    Could be, though $post has to be one or the other, get_the_date() should work off the same one. Try replacing get_the date() with mysql2date('d M y', $post->post_date) which is sort of what get_the_date() does once it decides what the current post is. You can change the date format to your liking, assuming this works at all.

    Thread Starter Myslovo

    (@myslovo)

    Dear bcworkz, it workz,

    thank you very, very, very much.

    Thread Starter Myslovo

    (@myslovo)

    I think I needed to click that “Mark this topic as resolved”. thanx again bcworkz!

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Need to add a couple of words before Tag name in a custom plugin’ is closed to new replies.